[BUGFIX] Ensure Lowercase folders on non-case-sensitive file system 80/59880/3
authorSusanne Moog <susanne.moog@typo3.com>
Wed, 6 Mar 2019 11:08:32 +0000 (12:08 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 8 Mar 2019 22:16:14 +0000 (23:16 +0100)
When creating files in a storage configured as not case-sensitive
the file name gets lowercased and TYPO3 works with the lowercased
version everywhere. When creating folders the lowercasing was missing,
resulting in an exception as the expectation still was to have only
lowercased files and folders on non-case-sensitive systems.

Lowercasing for folder creation has been implemented.

Resolves: #85583
Releases: master, 9.5, 8.7
Change-Id: Icd12ea602ceda9de8bc1a44c58f8ebeaef9a8008
Reviewed-on: https://review.typo3.org/c/59880
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php

index 496c42e..7a53c5e 100644 (file)
@@ -228,16 +228,18 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver implements Stream
     {
         $parentFolderIdentifier = $this->canonicalizeAndCheckFolderIdentifier($parentFolderIdentifier);
         $newFolderName = trim($newFolderName, '/');
-        if ($recursive == false) {
+        if ($recursive === false) {
             $newFolderName = $this->sanitizeFileName($newFolderName);
-            $newIdentifier = $parentFolderIdentifier . $newFolderName . '/';
+            $newIdentifier = $this->canonicalizeAndCheckFolderIdentifier($parentFolderIdentifier . $newFolderName . '/');
             GeneralUtility::mkdir($this->getAbsolutePath($newIdentifier));
         } else {
             $parts = GeneralUtility::trimExplode('/', $newFolderName);
             $parts = array_map([$this, 'sanitizeFileName'], $parts);
             $newFolderName = implode('/', $parts);
-            $newIdentifier = $parentFolderIdentifier . $newFolderName . '/';
-            GeneralUtility::mkdir_deep($this->getAbsolutePath($parentFolderIdentifier) . '/' . $newFolderName);
+            $newIdentifier = $this->canonicalizeAndCheckFolderIdentifier(
+                $parentFolderIdentifier . $newFolderName . '/'
+            );
+            GeneralUtility::mkdir_deep($this->getAbsolutePath($newIdentifier));
         }
         return $newIdentifier;
     }