aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-09-18 11:13:20 +0200
committerRobin Appelman <robin@icewind.nl>2024-09-19 13:59:08 +0200
commit5bcd74ae87c6e739d3711262345a5881f785e863 (patch)
tree695135dd417b47f69d9538eeb6c4f3502423a30d /lib
parent337df1f7600c32c91543dcfef9d476b4f49e85cc (diff)
downloadnextcloud-server-5bcd74ae87c6e739d3711262345a5881f785e863.tar.gz
nextcloud-server-5bcd74ae87c6e739d3711262345a5881f785e863.zip
fix: get source file before moving the cache item in objectstore moveFromStorage
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 1d940b7e619..93beaaeca6c 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -605,10 +605,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);