summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-06-29 18:14:47 +0200
committerRobin Appelman <robin@icewind.nl>2020-07-31 17:32:05 +0200
commit7e12f9c9bb757fa71abd216b21223cc738b8acc2 (patch)
tree6f045f140851aeb2623d8bffbfd8db12343ef122 /lib
parentd56beaf07a6ee85638024c135d793da8020684da (diff)
downloadnextcloud-server-7e12f9c9bb757fa71abd216b21223cc738b8acc2.tar.gz
nextcloud-server-7e12f9c9bb757fa71abd216b21223cc738b8acc2.zip
fix moving files from external storage to object store trashbin
having the "cache rename" after the "storage move" caused the target to get the fileid from the source file, without taking care that the object is stored under the original file id. By doing the "cache rename" first, we trigger the "update existing file" logic while moving the file to the object store and the object gets stored for the correct file id Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Storage/Common.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 82ac49b9fdf..10941937a55 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -618,18 +618,15 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
}
} else {
$source = $sourceStorage->fopen($sourceInternalPath, 'r');
- // TODO: call fopen in a way that we execute again all storage wrappers
- // to avoid that we bypass storage wrappers which perform important actions
- // for this operation. Same is true for all other operations which
- // are not the same as the original one.Once this is fixed we also
- // need to adjust the encryption wrapper.
- $target = $this->fopen($targetInternalPath, 'w');
- list(, $result) = \OC_Helper::streamCopy($source, $target);
+ if ($source) {
+ $result = $this->writeStream($targetInternalPath, $source) > 0;
+ } else {
+ $result = false;
+ }
+
if ($result and $preserveMtime) {
$this->touch($targetInternalPath, $sourceStorage->filemtime($sourceInternalPath));
}
- fclose($source);
- fclose($target);
if (!$result) {
// delete partially written target file