diff options
author | Robin Appelman <robin@icewind.nl> | 2020-06-29 18:14:47 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-07-23 15:24:44 +0200 |
commit | 59498493220a666573516679e7752d09543ac1b5 (patch) | |
tree | 77d87a5499dc077bd5f36b9fbcf19a58b45c0cae /apps/files_trashbin/lib | |
parent | ba39d7adde56114bffe407e23edbbbb5730252fd (diff) | |
download | nextcloud-server-59498493220a666573516679e7752d09543ac1b5.tar.gz nextcloud-server-59498493220a666573516679e7752d09543ac1b5.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 'apps/files_trashbin/lib')
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index f73cc1f4aa6..e23368f825b 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -278,6 +278,8 @@ class Trashbin { /** @var \OC\Files\Storage\Storage $sourceStorage */ [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath); + $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); + try { $moveSuccessful = true; if ($trashStorage->file_exists($trashInternalPath)) { @@ -301,8 +303,6 @@ class Trashbin { return false; } - $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); - if ($moveSuccessful) { $query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)"); $result = $query->execute([$filename, $timestamp, $location, $owner]); |