diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 5adbdeca6ade2..8fc99c637a9d3 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -48,6 +48,7 @@ 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 @@ public static function restore($file, $filename, $timestamp) { $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