From f31fd1f53436fcf2e86dfb7d6511438c78117c96 Mon Sep 17 00:00:00 2001 From: Oliver Bartsch <bo@cedev.de> Date: Mon, 18 Dec 2023 09:55:32 +0100 Subject: [PATCH] [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/+/82212 Tested-by: Oliver Bartsch <bo@cedev.de> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Oliver Bartsch <bo@cedev.de> --- typo3/sysext/core/Classes/LinkHandling/FileLinkHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/core/Classes/LinkHandling/FileLinkHandler.php b/typo3/sysext/core/Classes/LinkHandling/FileLinkHandler.php index e1df63952017..f6d7ce8dfbc1 100644 --- a/typo3/sysext/core/Classes/LinkHandling/FileLinkHandler.php +++ b/typo3/sysext/core/Classes/LinkHandling/FileLinkHandler.php @@ -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; -- GitLab