[BUGFIX] Prevent exception in file list 79/59879/2
authorSusanne Moog <susanne.moog@typo3.com>
Wed, 6 Mar 2019 10:36:27 +0000 (11:36 +0100)
committerBenni Mack <benni@typo3.org>
Fri, 8 Mar 2019 12:39:56 +0000 (13:39 +0100)
When creating a file with a disallowed file
extension an exception was thrown as on creation
the redirect to edit interface on a non-existing
file was called.

Though the better fix might be to prevent the
request for an invalid file to be sent at all
this fix ensures a working file list module in
a more "surgical" way to allow secure backporting.

Resolves: #87527
Releases: master, 9.5, 8.7
Change-Id: I35a054c05b37c09acab83a7aa9eca89cf9ebf6b9
Reviewed-on: https://review.typo3.org/c/59879
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Guido Schmechel <guido.schmechel@brandung.de>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Controller/File/FileController.php

index 01eada3..784d042 100644 (file)
@@ -104,7 +104,9 @@ class FileController
         if ($request->getParsedBody()['edit'] ?? '') {
             /** @var File $file */
             $file = $this->fileData['newfile'][0];
-            $this->redirect = $this->getFileEditRedirect($file) ?? $this->redirect;
+            if ($file !== null) {
+                $this->redirect = $this->getFileEditRedirect($file) ?? $this->redirect;
+            }
         }
         if ($this->redirect) {
             return new RedirectResponse(