From fafce34aa035c420a8a30c9dc0f6a7c7c7324166 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 25 Jul 2019 03:25:12 +0200 Subject: [PATCH 1/2] dont try to copy trash items to user if the user has not enough free space Signed-off-by: Robin Appelman --- apps/files_trashbin/lib/Trashbin.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 1cf3e68354..d37c99cdef 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -189,7 +189,10 @@ class Trashbin { $target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp; $source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp; - self::copy_recursive($source, $target, $view); + $free = $view->free_space($target); + if (($free < 0) || ($view->filesize($source) < $free)) { + self::copy_recursive($source, $target, $view); + } if ($view->file_exists($target)) { From 9bf8ee701f535d51ecf92cee291935140b3bdc37 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 4 Sep 2019 13:06:07 +0200 Subject: [PATCH 2/2] Update apps/files_trashbin/lib/Trashbin.php Co-Authored-By: Morris Jobke --- apps/files_trashbin/lib/Trashbin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index d37c99cdef..a06a5145d9 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -190,7 +190,9 @@ class Trashbin { $target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp; $source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp; $free = $view->free_space($target); - if (($free < 0) || ($view->filesize($source) < $free)) { + $isUnknownOrUnlimitedFreeSpace = $free < 0; + $isEnoughFreeSpaceLeft = $view->filesize($source) < $free; + if ($isUnknownOrUnlimitedFreeSpace || $isEnoughFreeSpaceLeft) { self::copy_recursive($source, $target, $view); }