Issue Bug Closed

#92957Exception in FileDumpController when trying to download a missing or deleted file using /index.php?eID=dumpFile

Stephan Großberndt 11/30/20, 13:32 updated 05/11/21, 16:02

Description

When trying to download a file using /index.php?eID=dumpFile which is not there (missing or deleted) an exception occurs which leads to HTTP 500 instead of 404:

Core: Exception handler (WEB): 
Uncaught TYPO3 Exception:
Argument 1 passed to TYPO3\CMS\Core\Controller\FileDumpController::isFileValid() must implement interface TYPO3\CMS\Core\Resource\FileInterface, null given,
called in /typo3_src-9.5.23/typo3/sysext/core/Classes/Controller/FileDumpController.php on line 67
TypeError thrown in file /typo3_src-9.5.23/typo3/sysext/core/Classes/Controller/FileDumpController.php in line 114.
Requested URL: https://example.org/index.php?eID=dumpFile&t=f&f=4711&token=--AnonymizedToken--&download=

This happens because $file is set to NULL and then passed to isFileValid() which expects $file not to be NULL:

if ($file->isDeleted() || $file->isMissing()) {
  $file = null;
}
if (!$this->isFileValid($file)) {
  $file = null;
}

This is a regression of #91754 / https://review.typo3.org/c/Packages/TYPO3.CMS/+/65126

Reviews 3