aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-11-17 08:43:22 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2023-11-17 12:54:37 +0100
commit5172baaf8b0b028328a59e7692bd395b5da2883b (patch)
tree0071d6a00ccd33d7d0c496620ae191383a57bd17 /lib/private/Files/ObjectStore
parent158aedb549b253b0b8a84a7c68c0d7bca9e7be54 (diff)
downloadnextcloud-server-5172baaf8b0b028328a59e7692bd395b5da2883b.tar.gz
nextcloud-server-5172baaf8b0b028328a59e7692bd395b5da2883b.zip
fix(ObjectStore): Make copying behavior consistent with local storage
Drop file permissions on copy like we do on local storage. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/Files/ObjectStore')
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 4dceee9a58b..eb8aaffe1e0 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -68,6 +68,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
private $logger;
+ private bool $handleCopiesAsOwned;
+
/** @var bool */
protected $validateWrites = true;
@@ -88,6 +90,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
if (isset($params['validateWrites'])) {
$this->validateWrites = (bool)$params['validateWrites'];
}
+ $this->handleCopiesAsOwned = (bool)($params['handleCopiesAsOwned'] ?? false);
$this->logger = \OC::$server->getLogger();
}
@@ -651,6 +654,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
try {
$this->objectStore->copyObject($sourceUrn, $targetUrn);
+ if ($this->handleCopiesAsOwned) {
+ // Copied the file thus we gain all permissions as we are the owner now ! warning while this aligns with local storage it should not be used and instead fix local storage !
+ $cache->update($targetId, ['permissions' => \OCP\Constants::PERMISSION_ALL]);
+ }
} catch (\Exception $e) {
$cache->remove($to);