aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-09-18 11:13:20 +0200
committerRobin Appelman <robin@icewind.nl>2024-09-18 13:54:55 +0200
commit879fcc4253f74f4cf0d156866dd78c45caf39fac (patch)
tree4157884cc0b0840171df181307191c31c986c6d4 /lib/private
parenta1c2a659a24571afa052f6fd5c195e8cdb0465ea (diff)
downloadnextcloud-server-879fcc4253f74f4cf0d156866dd78c45caf39fac.tar.gz
nextcloud-server-879fcc4253f74f4cf0d156866dd78c45caf39fac.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/private')
-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 1b55b4b3b44..c29eb6a63e3 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -607,10 +607,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);