summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-09-04 20:06:43 +0200
committerGitHub <noreply@github.com>2019-09-04 20:06:43 +0200
commitd744c04a865766cf2e5c11e8c43183fd4bf9669e (patch)
tree366e5ffb5b50b79b96aba287fae25b56d44aae97 /apps/files_trashbin/lib
parent0e19e55e242af3e665035f5928d293ed9addc4ed (diff)
parent9bf8ee701f535d51ecf92cee291935140b3bdc37 (diff)
downloadnextcloud-server-d744c04a865766cf2e5c11e8c43183fd4bf9669e.tar.gz
nextcloud-server-d744c04a865766cf2e5c11e8c43183fd4bf9669e.zip
Merge pull request #16534 from nextcloud/trash-copy-free-space
dont try to copy trash items to user if the user has not enough free space
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/Trashbin.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index 1cf3e683543..a06a5145d99 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -189,7 +189,12 @@ 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);
+ $isUnknownOrUnlimitedFreeSpace = $free < 0;
+ $isEnoughFreeSpaceLeft = $view->filesize($source) < $free;
+ if ($isUnknownOrUnlimitedFreeSpace || $isEnoughFreeSpaceLeft) {
+ self::copy_recursive($source, $target, $view);
+ }
if ($view->file_exists($target)) {