Merge pull request #14693 from nextcloud/trashbin-restore-readonly-target

dont try to restore a trashbin item to a readonly target
This commit is contained in:
Roeland Jago Douma 2019-03-14 20:26:49 +01:00 committed by GitHub
commit c7dd07966a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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