Skip to content
Snippets Groups Projects
Commit bc0f7713 authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[BUGFIX] Prevent exception for invalid file link

Using an invalid uid to link to a file
does no longer throw an exception, since
this prevents the backend user from fixing
the invalid entry, because the edit form
can no longer be accessed.

Resolves: #102670
Releases: main, 12.4
Change-Id: I634eb88a2ddf671abbb88870d664e739e8127ce9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82201


Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarJochen Roth <rothjochen@gmail.com>
Reviewed-by: default avatarJochen Roth <rothjochen@gmail.com>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
parent 2c30be8a
Branches
Tags
No related merge requests found
......@@ -86,10 +86,10 @@ class FileLinkHandler implements LinkHandlingInterface
*/
protected function resolveFile(array $data): ?FileInterface
{
if (isset($data['uid'])) {
if (is_numeric($data['uid'] ?? false)) {
return $this->getResourceFactory()->getFileObject($data['uid']);
}
if (isset($data['identifier'])) {
if (is_string($data['identifier'] ?? false) && $data['identifier'] !== '') {
return $this->getResourceFactory()->getFileObjectFromCombinedIdentifier($data['identifier']);
}
return null;
......
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