Skip to content
Snippets Groups Projects
Commit d8337905 authored by Andreas Allacher's avatar Andreas Allacher Committed by Frank Nägler
Browse files

[FOLLOWUP][BUGFIX] ImageViewHelper should catch exceptions

We also need to catch RuntimeException and InvalidArgumentException
InvalidArgumentException might be thrown if a storage does not exist.
RuntimeException if a file is outside a storage.

Change-Id: I994d8e7ef8b515f23ccc01847cefac0202f14b6f
Releases: master, 6.2
Resolves: #71686
Reviewed-on: https://review.typo3.org/45166


Reviewed-by: default avatarJan Helke <typo3@helke.de>
Tested-by: default avatarJan Helke <typo3@helke.de>
Reviewed-by: default avatarJosef Glatz <josef.glatz@typo3.org>
Reviewed-by: default avatarFrank Nägler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Nägler <frank.naegler@typo3.org>
parent 2882393b
Branches
Tags
No related merge requests found
......@@ -140,7 +140,13 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
$this->tag->addAttribute('title', $title);
}
} catch (ResourceDoesNotExistException $e) {
// thrown if file does not exist
} catch (\UnexpectedValueException $e) {
// thrown if a file has been replaced with a folder
} catch (\RuntimeException $e) {
// RuntimeException thrown if a file is outside of a storage
} catch (\InvalidArgumentException $e) {
// thrown if file storage does not exist
}
return $this->tag->render();
......
......@@ -144,7 +144,13 @@ class ImageViewHelper extends AbstractViewHelper implements CompilableInterface
$processedImage = $imageService->applyProcessingInstructions($image, $processingInstructions);
return $imageService->getImageUri($processedImage, $absolute);
} catch (ResourceDoesNotExistException $e) {
// thrown if file does not exist
} catch (\UnexpectedValueException $e) {
// thrown if a file has been replaced with a folder
} catch (\RuntimeException $e) {
// RuntimeException thrown if a file is outside of a storage
} catch (\InvalidArgumentException $e) {
// thrown if file storage does not exist
}
return '';
}
......
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