diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index d6bca4d35b279..443a2b554a065 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -42,7 +42,6 @@ use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use OC\Files\Search\SearchComparison; use OC\Files\Search\SearchQuery; -use OCP\Constants; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Cache\CacheEntryInsertedEvent; @@ -1017,14 +1016,6 @@ public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, str throw new \RuntimeException("Invalid source cache entry on copyFromCache"); } $data = $this->cacheEntryToArray($sourceEntry); - $targetParentEntry = $this->get(dirname($targetPath)); - if ($targetParentEntry !== false && $targetParentEntry !== null) { - if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) { - $data['permissions'] = $targetParentEntry->getPermissions(); - } else { - $data['permissions'] = $targetParentEntry->getPermissions() & ~Constants::PERMISSION_CREATE; - } - } $fileId = $this->put($targetPath, $data); if ($fileId <= 0) { throw new \RuntimeException("Failed to copy to " . $targetPath . " from cache with source data " . json_encode($data) . " "); diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 4050daddb35a7..0d208e91c5da2 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -539,7 +539,13 @@ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t 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(); + if (is_array($sourceEntryData) && array_key_exists('scan_permissions', $sourceEntryData)) { + $sourceEntryData['permissions'] = $sourceEntryData['scan_permissions']; + } + $sourceEntry = new CacheEntry($sourceEntryData); $this->copyInner($sourceEntry, $targetInternalPath); return true; }