[BUGFIX] Use CharsetConverter for strtolower of FAL identifier
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / Driver / AbstractHierarchicalFilesystemDriver.php
index 9c76645..a8873d8 100644 (file)
@@ -14,8 +14,9 @@ namespace TYPO3\CMS\Core\Resource\Driver;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Resource\Exception\InvalidPathException;
+use TYPO3\CMS\Core\Charset\CharsetConverter;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Resource\Exception\InvalidPathException;
 use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
@@ -24,6 +25,24 @@ use TYPO3\CMS\Core\Utility\PathUtility;
 abstract class AbstractHierarchicalFilesystemDriver extends AbstractDriver
 {
     /**
+     * @var CharsetConverter
+     */
+    protected $charsetConversion;
+
+    /**
+     * Gets the charset conversion object.
+     *
+     * @return CharsetConverter
+     */
+    protected function getCharsetConversion()
+    {
+        if (!isset($this->charsetConversion)) {
+            $this->charsetConversion = GeneralUtility::makeInstance(CharsetConverter::class);
+        }
+        return $this->charsetConversion;
+    }
+
+    /**
      * Wrapper for \TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr()
      *
      * @param string $theFile Filepath to evaluate
@@ -67,7 +86,7 @@ abstract class AbstractHierarchicalFilesystemDriver extends AbstractDriver
             $fileIdentifier = $this->canonicalizeAndCheckFilePath($fileIdentifier);
             $fileIdentifier = '/' . ltrim($fileIdentifier, '/');
             if (!$this->isCaseSensitiveFileSystem()) {
-                $fileIdentifier = strtolower($fileIdentifier);
+                $fileIdentifier = $this->getCharsetConversion()->conv_case('utf-8', $fileIdentifier, 'toLower');
             }
         }
         return $fileIdentifier;