aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Cache/Cache.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-06-30 18:15:08 +0200
committerRobin Appelman <robin@icewind.nl>2025-06-30 18:15:08 +0200
commit6fc1105b9218dd1bdb8822fc7891b1bc7c9ecc6b (patch)
tree679f132fd94296bf98c507daa688611040a147bc /lib/private/Files/Cache/Cache.php
parent26c5166790a1620ea4248229f4997330493a998d (diff)
downloadnextcloud-server-copy-all-permissions.tar.gz
nextcloud-server-copy-all-permissions.zip
fix: give target file all permissions on copycopy-all-permissions
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Cache/Cache.php')
-rw-r--r--lib/private/Files/Cache/Cache.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index cb160115851..609f921386b 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -14,6 +14,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\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Cache\CacheEntryInsertedEvent;
@@ -1162,6 +1163,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 && $sourceCache->hasEncryptionWrapper() && !$this->hasEncryptionWrapper()) {