From 7dccf5f257b77b4cbd6366d1fab56a412fe93cd8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 30 Jun 2025 18:15:08 +0200 Subject: [PATCH] fix: give target file all permissions on copy Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Cache.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 6a546f78711..96b0c413e4d 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -16,6 +16,7 @@ use OC\Files\Search\SearchComparison; use OC\Files\Search\SearchQuery; use OC\Files\Storage\Wrapper\Encryption; use OC\SystemConfig; +use OCP\Constants; use OCP\DB\Exception; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; @@ -1224,6 +1225,12 @@ class Cache implements ICache { throw new \RuntimeException('Invalid source cache entry on copyFromCache'); } $data = $this->cacheEntryToArray($sourceEntry); + // since we are essentially creating a new file, we don't have to obey the source permissions + if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) { + $data['permissions'] = Constants::PERMISSION_ALL; + } else { + $data['permissions'] = Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE; + } // when moving from an encrypted storage to a non-encrypted storage remove the `encrypted` mark if ($sourceCache instanceof Cache