Skip to content

Commit

Permalink
Merge pull request #13 from bolt/bobdenotter-patch-1
Browse files Browse the repository at this point in the history
Clear `$_FILES` after uploading
  • Loading branch information
bobdenotter authored Oct 21, 2020
2 parents 4e8932f + 136feeb commit cfb338e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Controller/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public function handleUpload(Request $request): JsonResponse
try {
/** @var File $result */
$result = $uploadHandler->process($request->files->get('file'));

// Clear the 'files' from the superglobals. We do this, so that we prevent breakage
// later on, should we do a `Request::createFromGlobals();`
// @see: https://github.com/bolt/core/issues/2027
$_FILES = [];
} catch (\Throwable $e) {
return new JsonResponse([
'error' => true,
Expand Down

0 comments on commit cfb338e

Please sign in to comment.