diff options
author | Carl Schwan <carl@carlschwan.eu> | 2021-10-28 15:38:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 15:38:20 +0300 |
commit | df4e6bab6938287e7c0a876bdeacb7e0d8617723 (patch) | |
tree | e1bf43643bcdcc3139bbbc60703c2c120b7797f3 /lib/private/Files | |
parent | 74cfe7348d78b077d28caacc692e4f8cecee526b (diff) | |
parent | bfa60aaf2774d08fe8ec3d42ff3a87e3b2f44277 (diff) |
Merge pull request #29115 from nextcloud/work/carl/correct-permissions-when-copying
Fix permissions when copying from ObjectStorage
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 2 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index aec97d1ad33..443a2b554a0 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -1009,7 +1009,7 @@ class Cache implements ICache { * @param ICache $sourceCache * @param ICacheEntry $sourceEntry * @param string $targetPath - * @return int fileid of copied entry + * @return int fileId of copied entry */ public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { if ($sourceEntry->getId() < 0) { diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 4050daddb35..adb3928b28a 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -539,7 +539,15 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class)) { /** @var ObjectStoreStorage $sourceStorage */ if ($sourceStorage->getObjectStore()->getStorageId() === $this->getObjectStore()->getStorageId()) { + /** @var CacheEntry $sourceEntry */ $sourceEntry = $sourceStorage->getCache()->get($sourceInternalPath); + $sourceEntryData = $sourceEntry->getData(); + // $sourceEntry['permissions'] here is the permissions from the jailed storage for the current + // user. Instead we use $sourceEntryData['scan_permissions'] that are the permissions from the + // unjailed storage. + if (is_array($sourceEntryData) && array_key_exists('scan_permissions', $sourceEntryData)) { + $sourceEntry['permissions'] = $sourceEntryData['scan_permissions']; + } $this->copyInner($sourceEntry, $targetInternalPath); return true; } |