summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-01-28 15:16:55 +0100
committerRobin Appelman <icewind@owncloud.com>2015-01-28 15:16:55 +0100
commita59612752e3b2829516833ea5b189df63ff49cd0 (patch)
treea6e38fa11025a0d8d94bd27660d6ee953b621422
parentcec43df0f0c4b7e23e406788615bcbbe8738ab37 (diff)
downloadnextcloud-server-a59612752e3b2829516833ea5b189df63ff49cd0.tar.gz
nextcloud-server-a59612752e3b2829516833ea5b189df63ff49cd0.zip
Fix trash error when deleting files with the same name at the same time (happens in unit tests)
-rw-r--r--apps/files_trashbin/lib/trashbin.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 4086bb1216d..0576be66b4b 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -167,6 +167,9 @@ class Trashbin {
$trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp;
try {
$sizeOfAddedFiles = $view->filesize('/files/' . $file_path);
+ if ($view->file_exists($trashPath)) {
+ $view->unlink($trashPath);
+ }
$view->rename('/files/' . $file_path, $trashPath);
} catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) {
$sizeOfAddedFiles = false;