[BUGFIX] Ensure new deep dirs don't contain double slashes 24/39624/2
authorThomas Deuling <tdeuling@gmail.com>
Fri, 30 Jan 2015 10:06:42 +0000 (11:06 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 20 May 2015 11:18:49 +0000 (13:18 +0200)
The method of GeneralUtility::mkdir_deep has two parameters, which are
concatenated. This could end up in a double slashes. To prevent that,
the parameters are modified to concat them with only one slash.

Resolves: #63920
Releases: master, 6.2
Change-Id: I2d15f6c33550f9045db9b7730f7b074ae54a18dc
Reviewed-on: http://review.typo3.org/39624
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Utility/GeneralUtility.php

index 40132ba..2a668c6 100755 (executable)
@@ -2848,7 +2848,8 @@ Connection: close
                if (!is_string($deepDirectory)) {
                        throw new \InvalidArgumentException('The specified directory is of type "' . gettype($deepDirectory) . '" but a string is expected.', 1303662956);
                }
-               $fullPath = $directory . $deepDirectory;
+               // Ensure there is only one slash
+               $fullPath = rtrim($directory, '/') . '/' . ltrim($deepDirectory, '/');
                if (!is_dir($fullPath) && strlen($fullPath) > 0) {
                        $firstCreatedPath = self::createDirectoryPath($fullPath);
                        if ($firstCreatedPath !== '') {