mirror of
https://github.com/Karaka-Management/oms-Draw.git
synced 2026-02-12 05:08:40 +00:00
add todos from github
This commit is contained in:
parent
8245bbd073
commit
9cecbcb89a
|
|
@ -82,13 +82,21 @@ final class ApiController extends Controller
|
||||||
$filename = '';
|
$filename = '';
|
||||||
$rnd = '';
|
$rnd = '';
|
||||||
|
|
||||||
// todo: implement limit since this could get exploited
|
$i = 0;
|
||||||
do {
|
do {
|
||||||
$filename = \sha1(((string) $request->getData('image')) . $rnd);
|
$filename = \sha1(((string) $request->getData('image')) . $rnd);
|
||||||
$filename .= '.' . $extension;
|
$filename .= '.' . $extension;
|
||||||
|
|
||||||
$rnd = \mt_rand();
|
$rnd = \mt_rand();
|
||||||
} while (\file_exists($path . '/' . $filename));
|
|
||||||
|
++$i;
|
||||||
|
} while (\file_exists($path . '/' . $filename) && $i < 10000);
|
||||||
|
|
||||||
|
// protection against infinite loop
|
||||||
|
if ($i >= 10000) {
|
||||||
|
$this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Draw', 'Draw failed.', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$fullPath = __DIR__ . '/../../../' . $path . '/' . $filename;
|
$fullPath = __DIR__ . '/../../../' . $path . '/' . $filename;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user