mirror of
https://github.com/nextcloud/server.git
synced 2026-06-16 20:19:48 -04:00
fix: get source file before moving the cache item in objectstore moveFromStorage
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
88aa7683d9
commit
68e82ba0e5
1 changed files with 5 additions and 1 deletions
|
|
@ -628,10 +628,14 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
|
|||
}
|
||||
$sourceStorage->rmdir($sourceInternalPath);
|
||||
} else {
|
||||
$sourceStream = $sourceStorage->fopen($sourceInternalPath, 'r');
|
||||
if (!$sourceStream) {
|
||||
return false;
|
||||
}
|
||||
// move the cache entry before the contents so that we have the correct fileid/urn for the target
|
||||
$this->getCache()->moveFromCache($sourceCache, $sourceInternalPath, $targetInternalPath);
|
||||
try {
|
||||
$this->writeStream($targetInternalPath, $sourceStorage->fopen($sourceInternalPath, 'r'), $sourceCacheEntry->getSize());
|
||||
$this->writeStream($targetInternalPath, $sourceStream, $sourceCacheEntry->getSize());
|
||||
} catch (\Exception $e) {
|
||||
// restore the cache entry
|
||||
$sourceCache->moveFromCache($this->getCache(), $targetInternalPath, $sourceInternalPath);
|
||||
|
|
|
|||
Loading…
Reference in a new issue