[BUGFIX] Fix start of identifier from /./ to / 48/20348/2
authorAlexander Opitz <opitz.alexander@googlemail.com>
Tue, 30 Apr 2013 08:26:21 +0000 (10:26 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 17 May 2013 17:23:27 +0000 (19:23 +0200)
The PHP function dirname returns an dot if the given filename
do not have a path included. On this path we pre- and append a
slash as directory seperator and this leads to /./ for the identifier.

By handling the dot and replace it with a single slash we get the
clean identifier we need. The result of dirname shouldn't be
empty, but we also will replace this with a single slash.

The problem didn't occured yet, as we didn't saved the resulting
file object in the index, which was changed by #46595

Reproducing:
* select the default LocalStorage root directory (fileadmin/)
* Upload a file
* Look in the sys_file table you have 2 entries without this patch.

Resolves: #47705
Releases: 6.2, 6.1, 6.0
Change-Id: I1c927fe768e3b622fde8d9f6665f78bf277b46f7
Reviewed-on: https://review.typo3.org/20348
Reviewed-by: Peter Niederlag
Tested-by: Peter Niederlag
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Reviewed-by: Stefan Neufeind
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php

index 1f41361..c1afc57 100644 (file)
@@ -225,7 +225,9 @@ class LocalDriver extends \TYPO3\CMS\Core\Resource\Driver\AbstractDriver {
                $dirPath = \TYPO3\CMS\Core\Utility\GeneralUtility::fixWindowsFilePath(
                        PathUtility::dirname($fileIdentifier)
                );
-               if ($dirPath !== '' && $dirPath !== '/') {
+               if ($dirPath === '' || $dirPath === '.') {
+                       $dirPath = '/';
+               } elseif ($dirPath !== '/') {
                        $dirPath = '/' . trim($dirPath, '/') . '/';
                }
                $absoluteFilePath = $this->absoluteBasePath . ltrim($fileIdentifier, '/');