Fix trash error when deleting files with the same name at the same time (happens in unit tests)

This commit is contained in:
Robin Appelman 2015-01-28 15:16:55 +01:00
parent cec43df0f0
commit a59612752e
1 changed files with 3 additions and 0 deletions

View File

@ -167,6 +167,9 @@ class Trashbin {
$trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp;
try { try {
$sizeOfAddedFiles = $view->filesize('/files/' . $file_path); $sizeOfAddedFiles = $view->filesize('/files/' . $file_path);
if ($view->file_exists($trashPath)) {
$view->unlink($trashPath);
}
$view->rename('/files/' . $file_path, $trashPath); $view->rename('/files/' . $file_path, $trashPath);
} catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) { } catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) {
$sizeOfAddedFiles = false; $sizeOfAddedFiles = false;