From 5e6ac2b8494c5a8f43dbd1460c427922570413ab Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Mon, 7 Mar 2022 10:15:53 +0100 Subject: [PATCH] files: remove destination file before copying new content (WORM) --- lib/private/Files/Storage/Local.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 1318b1c401d74..5e37aa77d2048 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -354,6 +354,8 @@ public function copy($path1, $path2) { return parent::copy($path1, $path2); } else { $oldMask = umask(022); + // support Write-Once-Read-Many filesystems + $this->unlink($path2); $result = copy($this->getSourcePath($path1), $this->getSourcePath($path2)); umask($oldMask); return $result;