]> source.dussan.org Git - nextcloud-server.git/commitdiff
use source cache when listing folder during recursive copy 38890/head
authorRobin Appelman <robin@icewind.nl>
Fri, 26 May 2023 12:51:05 +0000 (14:51 +0200)
committerJulius Härtl <jus@bitgrid.net>
Mon, 19 Jun 2023 14:40:15 +0000 (16:40 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/ObjectStore/ObjectStoreStorage.php

index 978b5b0451c8822d98c5ce45f9c09a44859e9adc..d918bd9872971234bd508a4437ef3b2cc5910dc3 100644 (file)
@@ -38,6 +38,7 @@ use Icewind\Streams\IteratorDirectory;
 use OC\Files\Cache\Cache;
 use OC\Files\Cache\CacheEntry;
 use OC\Files\Storage\PolyFill\CopyDirectory;
+use OCP\Files\Cache\ICache;
 use OCP\Files\Cache\ICacheEntry;
 use OCP\Files\FileInfo;
 use OCP\Files\GenericFileException;
@@ -593,7 +594,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
                                if (is_array($sourceEntryData) && array_key_exists('scan_permissions', $sourceEntryData)) {
                                        $sourceEntry['permissions'] = $sourceEntryData['scan_permissions'];
                                }
-                               $this->copyInner($sourceEntry, $targetInternalPath);
+                               $this->copyInner($sourceStorage->getCache(), $sourceEntry, $targetInternalPath);
                                return true;
                        }
                }
@@ -611,12 +612,12 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
                        throw new NotFoundException('Source object not found');
                }
 
-               $this->copyInner($sourceEntry, $target);
+               $this->copyInner($cache, $sourceEntry, $target);
 
                return true;
        }
 
-       private function copyInner(ICacheEntry $sourceEntry, string $to) {
+       private function copyInner(ICache $sourceCache, ICacheEntry $sourceEntry, string $to) {
                $cache = $this->getCache();
 
                if ($sourceEntry->getMimeType() === FileInfo::MIMETYPE_FOLDER) {
@@ -625,8 +626,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
                        }
                        $this->mkdir($to);
 
-                       foreach ($cache->getFolderContentsById($sourceEntry->getId()) as $child) {
-                               $this->copyInner($child, $to . '/' . $child->getName());
+                       foreach ($sourceCache->getFolderContentsById($sourceEntry->getId()) as $child) {
+                               $this->copyInner($sourceCache, $child, $to . '/' . $child->getName());
                        }
                } else {
                        $this->copyFile($sourceEntry, $to);