files: remove destination file before copying new content (WORM)

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
This commit is contained in:
Tigran Mkrtchyan 2022-03-07 10:15:53 +01:00
parent b6065a236f
commit 8fc4cf67f1
1 changed files with 2 additions and 0 deletions

View File

@ -372,6 +372,8 @@ class Local extends \OC\Files\Storage\Common {
return parent::copy($path1, $path2);
} else {
$oldMask = umask($this->defUMask);
// support Write-Once-Read-Many filesystems
$this->unlink($path2);
$result = copy($this->getSourcePath($path1), $this->getSourcePath($path2));
umask($oldMask);
return $result;