[BUGFIX] Correct storage selection (common prefixes)
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / ResourceFactory.php
index a0c39f6..7179245 100644 (file)
@@ -180,8 +180,11 @@ class ResourceFactory implements \TYPO3\CMS\Core\SingletonInterface {
                $bestMatchStorageUid = 0;
                $bestMatchLength = 0;
                foreach ($this->localDriverStorageCache as $storageUid => $basePath) {
-                       $commonPrefix = PathUtility::getCommonPrefix(array($basePath, $localPath));
-                       $matchLength = strlen($commonPrefix);
+                       $matchLength = strlen($basePath);
+                       if (substr($localPath, 0, $matchLength) !== $basePath) {
+                               continue;
+                       }
+
                        if ($matchLength > $bestMatchLength) {
                                $bestMatchStorageUid = intval($storageUid);
                                $bestMatchLength = $matchLength;