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 authored and backportbot[bot] committed Mar 16, 2021
commit 20ab946c3fe3096bb032542f4af7cde580fda0dc
12 changes: 6 additions & 6 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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 @@ -566,14 +567,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