[BUGFIX] Check if folder is within the filemount 16/47816/3
authorFrans Saris <franssaris@gmail.com>
Tue, 19 Apr 2016 16:04:20 +0000 (18:04 +0200)
committerNicole Cordes <typo3@cordes.co>
Wed, 20 Apr 2016 16:57:11 +0000 (18:57 +0200)
Before using the filemount base folder as root for the
folder->getReadablePath() check if the folder is within the filemount.

Change-Id: I8a4436fb2a0e512c7d2d1fc50b9d08febae8b256
Resolves: #73735
Releases: master, 7.6, 6.2
Reviewed-on: https://review.typo3.org/47816
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Classes/Resource/Folder.php

index a1a7b89..8549678 100644 (file)
@@ -105,7 +105,16 @@ class Folder implements FolderInterface
     public function getReadablePath($rootId = null)
     {
         if ($rootId === null) {
-            $rootId = $this->storage->getRootLevelFolder()->getIdentifier();
+            // Find first matching filemount and use that as root
+            foreach ($this->storage->getFileMounts() as $fileMount) {
+                if ($this->storage->isWithinFolder($fileMount['folder'], $this)) {
+                    $rootId = $fileMount['folder']->getIdentifier();
+                    break;
+                }
+            }
+            if ($rootId === null) {
+                $rootId = $this->storage->getRootLevelFolder()->getIdentifier();
+            }
         }
         $readablePath = '/';
         if ($this->identifier !== $rootId) {