From 62a969f056c9bebf1b9f579155c376fae31c207e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 14 Mar 2019 16:18:43 +0100 Subject: [PATCH] dont try to restore a trashbin item to a readonly target Signed-off-by: Robin Appelman --- apps/files_trashbin/lib/Trashbin.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 1d0d537990..1cf3e68354 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