[BUGFIX] Check if folder is within the filemount 17/47817/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 17:02:08 +0000 (19:02 +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/47817
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Classes/Resource/Folder.php

index d2974c4..4190ce9 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) {