[BUGFIX] FAL: Allow filenames like "0" 68/37768/4
authorMalte Muth <muth@fh-konzept.de>
Thu, 12 Mar 2015 06:56:57 +0000 (07:56 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Fri, 13 Mar 2015 12:52:50 +0000 (13:52 +0100)
When sanitizing file names, the condition is now checks less greedy
and does not reject filenames like "0" anymore.

Change-Id: I8b7aab813390f836a4e4edb418b77a7525d247d0
Releases: master, 6.2
Resolves: #65673
Reviewed-on: http://review.typo3.org/37768
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php

index 2603aff..87d5774 100644 (file)
@@ -316,10 +316,10 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
                        $cleanFileName = preg_replace('/[' . self::UNSAFE_FILENAME_CHARACTER_EXPRESSION . '\\xC0-\\xFF]/', '_', trim($fileName));
                }
                // Strip trailing dots and return
-               $cleanFileName = preg_replace('/\\.*$/', '', $cleanFileName);
-               if (!$cleanFileName) {
+               $cleanFileName = rtrim($cleanFileName, '.');
+               if ($cleanFileName === '') {
                        throw new \TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException(
-                               'File name ' . $cleanFileName . ' is invalid.',
+                               'File name ' . $fileName . ' is invalid.',
                                1320288991
                        );
                }