[BUGFIX] Prevent double slash in isWithin check 79/27379/2
authorAlexander Stehlik <alexander.stehlik@googlemail.com>
Thu, 6 Feb 2014 15:31:50 +0000 (16:31 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Tue, 11 Feb 2014 13:38:35 +0000 (14:38 +0100)
If the root folder is used as folder identifier (/) no slash is appended
so that isFirstPartOfStr works correctly in the isWithin check in
LocalDriver.

Resolves: #55740
Releases: 6.2
Change-Id: I2af1cd3759656502ea84887828dfb222f0a07b64
Reviewed-on: https://review.typo3.org/27379
Reviewed-by: Markus Klein
Reviewed-by: Markus Kasten
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php

index 03340cc..7825b62 100644 (file)
@@ -1084,7 +1084,12 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
                if ($folderIdentifier === $entryIdentifier) {
                        return TRUE;
                }
-               return GeneralUtility::isFirstPartOfStr($entryIdentifier, $folderIdentifier . '/');
+               // File identifier canonicalization will not modify a single slash so
+               // we must not append another slash in that case.
+               if ($folderIdentifier !== '/') {
+                       $folderIdentifier .= '/';
+               }
+               return GeneralUtility::isFirstPartOfStr($entryIdentifier, $folderIdentifier);
        }
 
        /**