Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-07-30 17:31:56 +0300
committerRobin Appelman <robin@icewind.nl>2020-07-31 18:21:28 +0300
commit193b3ead51fea5706d3ef14206684286b1b75c0e (patch)
tree8c00e803837b34d577068bb13353a7660f918dc2 /apps
parent4e6719b28c5bc5f4367af128e1ed731a1f3e6c4d (diff)
fix object store trashbin handling
object stores are "special" given how they interact with the cache on their own Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_trashbin/lib/Trashbin.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index ca5b1be24f8..76f8867c254 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -44,6 +44,7 @@
namespace OCA\Files_Trashbin;
use OC\Files\Filesystem;
+use OC\Files\ObjectStore\ObjectStoreStorage;
use OC\Files\View;
use OCA\Files_Trashbin\AppInfo\Application;
use OCA\Files_Trashbin\Command\Expire;
@@ -278,16 +279,22 @@ class Trashbin {
/** @var \OC\Files\Storage\Storage $sourceStorage */
[$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath);
+
+ if ($trashStorage->file_exists($trashInternalPath)) {
+ $trashStorage->unlink($trashInternalPath);
+ }
+
$connection = \OC::$server->getDatabaseConnection();
$connection->beginTransaction();
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
try {
$moveSuccessful = true;
- if ($trashStorage->file_exists($trashInternalPath)) {
- $trashStorage->unlink($trashInternalPath);
+
+ // when moving within the same object store, the cache update done above is enough to move the file
+ if (!($trashStorage->instanceOfStorage(ObjectStoreStorage::class) && $trashStorage->getId() === $sourceStorage->getId())) {
+ $trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
}
- $trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
} catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) {
$moveSuccessful = false;
if ($trashStorage->file_exists($trashInternalPath)) {