summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-03-14 20:26:49 +0100
committerGitHub <noreply@github.com>2019-03-14 20:26:49 +0100
commitc7dd07966a3d8a9c3b44a3feaef4319df7bc9f2f (patch)
tree6bed39635daa2354547bcafdc030e0b40a930bf0
parentdd0a5c4fb856213beac93dfdba59c3dff25e1f72 (diff)
parent62a969f056c9bebf1b9f579155c376fae31c207e (diff)
downloadnextcloud-server-c7dd07966a3d8a9c3b44a3feaef4319df7bc9f2f.tar.gz
nextcloud-server-c7dd07966a3d8a9c3b44a3feaef4319df7bc9f2f.zip
Merge pull request #14693 from nextcloud/trashbin-restore-readonly-target
dont try to restore a trashbin item to a readonly target
-rw-r--r--apps/files_trashbin/lib/Trashbin.php4
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