[BUGFIX] Check if folder is within the filemount
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / Folder.php
index da091e6..b2d1d25 100644 (file)
@@ -105,7 +105,16 @@ class Folder implements FolderInterface
     public function getReadablePath($rootId = null)
     {
         if ($rootId === null) {
     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) {
         }
         $readablePath = '/';
         if ($this->identifier !== $rootId) {