dont try to restore a trashbin item to a readonly target
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
762a8bb3d9
commit
62a969f056
|
@ -48,6 +48,7 @@ use OCA\Files_Trashbin\Command\Expire;
|
||||||
use OCP\Files\File;
|
use OCP\Files\File;
|
||||||
use OCP\Files\Folder;
|
use OCP\Files\Folder;
|
||||||
use OCP\Files\NotFoundException;
|
use OCP\Files\NotFoundException;
|
||||||
|
use OCP\Files\NotPermittedException;
|
||||||
use OCP\User;
|
use OCP\User;
|
||||||
|
|
||||||
class Trashbin {
|
class Trashbin {
|
||||||
|
@ -414,6 +415,9 @@ class Trashbin {
|
||||||
$mtime = $view->filemtime($source);
|
$mtime = $view->filemtime($source);
|
||||||
|
|
||||||
// restore file
|
// 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);
|
$restoreResult = $view->rename($source, $target);
|
||||||
|
|
||||||
// handle the restore result
|
// handle the restore result
|
||||||
|
|
Loading…
Reference in New Issue