Commit bb07a887 authored by Stephan Großberndt's avatar Stephan Großberndt Committed by Oliver Hader
Browse files

[BUGFIX] Avoid exception when trying to download a non-existing file

This patch fixes a regression introduced by change
https://review.typo3.org/c/Packages/TYPO3.CMS/+/65126 which lead to
an HTTP 500 exception instead of returning HTTP 404 by making sure
that FileDumpController->isFileValid() is not called with NULL as
parameter.

Resolves: #92957
Related: #91754
Releases: master, 10.4, 9.5
Change-Id: I824606867063f421f1a6fdfde4788846ddcc41a7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68897

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Reviewed-by: Stephan Großberndt's avatarStephan Großberndt <stephan.grossberndt@typo3.org>
Reviewed-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
parent d2beb364
......@@ -61,10 +61,7 @@ class FileDumpController
if (isset($parameters['f'])) {
try {
$file = ResourceFactory::getInstance()->getFileObject($parameters['f']);
if ($file->isDeleted() || $file->isMissing()) {
$file = null;
}
if (!$this->isFileValid($file)) {
if ($file->isDeleted() || $file->isMissing() || !$this->isFileValid($file)) {
$file = null;
}
} catch (\Exception $e) {
......@@ -72,10 +69,7 @@ class FileDumpController
}
} else {
$file = GeneralUtility::makeInstance(ProcessedFileRepository::class)->findByUid($parameters['p']);
if (!$file || $file->isDeleted()) {
$file = null;
}
if (!$this->isFileValid($file->getOriginalFile())) {
if (!$file || $file->isDeleted() || !$this->isFileValid($file->getOriginalFile())) {
$file = null;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment