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);