diff options
author | Robin Appelman <robin@icewind.nl> | 2021-03-08 18:50:33 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-03-12 17:22:40 +0100 |
commit | ad636ae12d0bba90979b05b5106959244d3ba256 (patch) | |
tree | f3ed858620989d2ebdcff4904ff92c6685c7b29b /lib | |
parent | d2bcb57a542b4119f47a687e2fbb6ee9f2525ddc (diff) | |
download | nextcloud-server-ad636ae12d0bba90979b05b5106959244d3ba256.tar.gz nextcloud-server-ad636ae12d0bba90979b05b5106959244d3ba256.zip |
use returned file id for object store copy
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 23483b3ab21..5d2cbe61ab6 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -33,6 +33,7 @@ namespace OC\Files\ObjectStore; use Icewind\Streams\CallbackWrapper; use Icewind\Streams\CountWrapper; use Icewind\Streams\IteratorDirectory; +use OC\Files\Cache\Cache; use OC\Files\Cache\CacheEntry; use OC\Files\Storage\PolyFill\CopyDirectory; use OCP\Files\Cache\ICacheEntry; @@ -581,14 +582,13 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { $sourceUrn = $this->getURN($sourceEntry->getId()); - $cache->copyFromCache($cache, $sourceEntry, $to); - $targetEntry = $cache->get($to); - - if (!$targetEntry) { - throw new \Exception('Target not in cache after copy'); + if (!$cache instanceof Cache) { + throw new \Exception("Invalid source cache for object store copy"); } - $targetUrn = $this->getURN($targetEntry->getId()); + $targetId = $cache->copyFromCache($cache, $sourceEntry, $to); + + $targetUrn = $this->getURN($targetId); try { $this->objectStore->copyObject($sourceUrn, $targetUrn); |