mirror of
https://github.com/Karaka-Management/oms-Draw.git
synced 2026-01-11 14:28: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 = '';
|
||||
$rnd = '';
|
||||
|
||||
// todo: implement limit since this could get exploited
|
||||
$i = 0;
|
||||
do {
|
||||
$filename = \sha1(((string) $request->getData('image')) . $rnd);
|
||||
$filename .= '.' . $extension;
|
||||
|
||||
$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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user