From 1284cc7bbf9a606346712201d8e0724e81f021c9 Mon Sep 17 00:00:00 2001 From: Jochen Roth <jochen.roth@b13.com> Date: Fri, 22 Sep 2023 13:09:14 +0200 Subject: [PATCH] [BUGFIX] Return empty string in case the folder does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, when linking to a non-existing folder in and the user clicks on save an error is thrown. This has been fixed by returning early with a empty string in case the folder object is null. Resolves: #102014 Releases: main, 12.4 Change-Id: I548737fae5e6957fe59bf414b70737bea28700b5 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81178 Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Tested-by: core-ci <typo3@b13.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> --- typo3/sysext/core/Classes/LinkHandling/FolderLinkHandler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/typo3/sysext/core/Classes/LinkHandling/FolderLinkHandler.php b/typo3/sysext/core/Classes/LinkHandling/FolderLinkHandler.php index 5707cb5f362f..232c0c7f6cee 100644 --- a/typo3/sysext/core/Classes/LinkHandling/FolderLinkHandler.php +++ b/typo3/sysext/core/Classes/LinkHandling/FolderLinkHandler.php @@ -46,6 +46,10 @@ class FolderLinkHandler implements LinkHandlingInterface */ public function asString(array $parameters): string { + if (!isset($parameters['folder'])) { + return ''; + } + // the magic with prepending slash if it is missing will not work on windows return $this->baseUrn . '?storage=' . $parameters['folder']->getStorage()->getUid() . '&identifier=' . urlencode('/' . ltrim($parameters['folder']->getIdentifier(), '/')); -- GitLab