diff options
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 1d0d5379905..1cf3e683543 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -48,6 +48,7 @@ use OCA\Files_Trashbin\Command\Expire; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\NotFoundException; +use OCP\Files\NotPermittedException; use OCP\User; class Trashbin { @@ -414,6 +415,9 @@ class Trashbin { $mtime = $view->filemtime($source); // restore file + if (!$view->isCreatable(dirname($target))) { + throw new NotPermittedException("Can't restore trash item because the target folder is not writable"); + } $restoreResult = $view->rename($source, $target); // handle the restore result |