[BUGFIX] Fix bug in linkhandler when file is selected 67/50767/2
authorSascha Egerer <sascha@sascha-egerer.de>
Thu, 24 Nov 2016 14:18:51 +0000 (15:18 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 3 Dec 2016 11:57:55 +0000 (12:57 +0100)
Selecting a file an the RTE linkhandler works but reopening
the linkhandler ends with a fatal error as a file object
is passed instead of string.

Change-Id: I56972ef8d25e9add0c51e1b72fd7034c1140bc01
Resolves: #78782
Releases: master
Reviewed-on: https://review.typo3.org/50767
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Markus Sommer <markussom@posteo.de>
Tested-by: Markus Sommer <markussom@posteo.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php

index 22b6fee..21dd8d9 100644 (file)
@@ -106,10 +106,10 @@ class FileLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac
         $this->expandFolder = isset($request->getQueryParams()['expandFolder']) ? $request->getQueryParams()['expandFolder'] : null;
         if (!empty($this->linkParts) && !isset($this->expandFolder)) {
             $this->expandFolder = $this->linkParts['url'][$this->mode];
+            if ($this->expandFolder instanceof File) {
+                $this->expandFolder = $this->expandFolder->getParentFolder();
+            }
             if ($this->expandFolder instanceof Folder) {
-                if ($this->mode === 'file') {
-                    $this->expandFolder = $this->expandFolder->getParentFolder();
-                }
                 $this->expandFolder = $this->expandFolder->getCombinedIdentifier();
             }
         }