Skip to content
Snippets Groups Projects
Commit 0892c764 authored by Markus Klein's avatar Markus Klein Committed by Oliver Hader
Browse files

[BUGFIX] Correctly treat uploaded file when replacing a file

Uploaded files must be moved with the specific PHP function,
otherwise permissions may be wrong.

Resolves: #76205
Releases: master, 7.6
Change-Id: Ic96e6b8927ed5d21131952004805fa72fb8b6857
Reviewed-on: https://review.typo3.org/48181


Reviewed-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
Reviewed-by: default avatarFrans Saris <franssaris@gmail.com>
Tested-by: default avatarFrans Saris <franssaris@gmail.com>
Reviewed-by: default avatarNicole Cordes <typo3@cordes.co>
Reviewed-by: default avatarOliver Hader <oliver.hader@typo3.org>
Tested-by: default avatarOliver Hader <oliver.hader@typo3.org>
parent c4514b77
No related branches found
No related tags found
No related merge requests found
......@@ -854,7 +854,11 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver
public function replaceFile($fileIdentifier, $localFilePath)
{
$filePath = $this->getAbsolutePath($fileIdentifier);
$result = rename($localFilePath, $filePath);
if (is_uploaded_file($localFilePath)) {
$result = move_uploaded_file($localFilePath, $filePath);
} else {
$result = rename($localFilePath, $filePath);
}
GeneralUtility::fixPermissions($filePath);
if ($result === false) {
throw new \RuntimeException('Replacing file ' . $fileIdentifier . ' with ' . $localFilePath . ' failed.', 1315314711);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment