Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use returned file id for object store copy
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Mar 12, 2021
commit ad636ae12d0bba90979b05b5106959244d3ba256
12 changes: 6 additions & 6 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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;
Expand Down Expand Up @@ -581,14 +582,13 @@ private function copyFile(ICacheEntry $sourceEntry, string $to) {

$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);
Expand Down