Skip to content
Snippets Groups Projects
Commit c2da28cb authored by Sascha Egerer's avatar Sascha Egerer Committed by Markus Klein
Browse files

[BUGFIX] Prevent duplicate '/' in filepath when uploading file

To prevent a duplicate '/' in a filepath the function
LocalDriver::getAbsolutePath should be used instead of
concatenating strings by hand.
This fixes also an issue that file uploads are not
possible on windows machines due to a incorrect filepath.

Resolves: #65230
Releases: master, 6.2
Change-Id: Ibe6ff9c8c1d6579c8da24f14cfd6e528f57a8e4f
Reviewed-on: http://review.typo3.org/37104


Reviewed-by: default avatarNicole Cordes <typo3@cordes.co>
Tested-by: default avatarNicole Cordes <typo3@cordes.co>
Reviewed-by: default avatarMarkus Klein <klein.t3@reelworx.at>
Tested-by: default avatarMarkus Klein <klein.t3@reelworx.at>
parent 23a9c3f3
Branches
Tags
No related merge requests found
......@@ -640,7 +640,7 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
}
$newFileName = $this->sanitizeFileName($newFileName !== '' ? $newFileName : PathUtility::basename($localFilePath));
$newFileIdentifier = $this->canonicalizeAndCheckFolderIdentifier($targetFolderIdentifier) . $newFileName;
$targetPath = $this->absoluteBasePath . $newFileIdentifier;
$targetPath = $this->getAbsolutePath($newFileIdentifier);
if ($removeOriginal) {
if (is_uploaded_file($localFilePath)) {
......@@ -755,8 +755,9 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
$newIdentifier = $targetFolderIdentifier . '/' . $fileName;
$newIdentifier = $this->canonicalizeAndCheckFileIdentifier($newIdentifier);
copy($sourcePath, $this->absoluteBasePath . $newIdentifier);
GeneralUtility::fixPermissions($this->absoluteBasePath . $newIdentifier);
$absoluteFilePath = $this->getAbsolutePath($newIdentifier);
copy($sourcePath, $absoluteFilePath);
GeneralUtility::fixPermissions($absoluteFilePath);
return $newIdentifier;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment