diff options
author | Robin Appelman <robin@icewind.nl> | 2024-09-18 11:13:20 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-09-19 17:44:27 +0200 |
commit | 68e82ba0e5fbdc7a02ac61eee3fe9dd4875d6bf4 (patch) | |
tree | da47b9e710f71565f7bb7b178ab01fe9591eba94 /lib | |
parent | 88aa7683d9620f60dca93be4dff33fc0ab47cf49 (diff) | |
download | nextcloud-server-68e82ba0e5fbdc7a02ac61eee3fe9dd4875d6bf4.tar.gz nextcloud-server-68e82ba0e5fbdc7a02ac61eee3fe9dd4875d6bf4.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.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 8b770ee19c5..d57b2d85777 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -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); |