From: Robin Appelman Date: Wed, 28 Jan 2015 14:16:55 +0000 (+0100) Subject: Fix trash error when deleting files with the same name at the same time (happens... X-Git-Tag: v8.0.0RC1~16^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a59612752e3b2829516833ea5b189df63ff49cd0;p=nextcloud-server.git Fix trash error when deleting files with the same name at the same time (happens in unit tests) --- 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;