diff options
author | Robin Appelman <robin@icewind.nl> | 2019-03-14 15:27:25 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2019-03-14 15:27:25 +0100 |
commit | 3ca1e900446d5d014beffd78c64990ee96540120 (patch) | |
tree | 5320357882f1356fb03086d2b5963e56c0a291b7 /lib/private/Files/Node | |
parent | 762a8bb3d9521a9f75d9e186150cb77241b3bc19 (diff) | |
download | nextcloud-server-3ca1e900446d5d014beffd78c64990ee96540120.tar.gz nextcloud-server-3ca1e900446d5d014beffd78c64990ee96540120.zip |
allow renaming the root of a movable mount even if the parent folder is readonly
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Node')
-rw-r--r-- | lib/private/Files/Node/Node.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index 41e8bf75242..dc025b79575 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -28,6 +28,7 @@ namespace OC\Files\Node; use OC\Files\Filesystem; +use OC\Files\Mount\MoveableMount; use OCP\Files\FileInfo; use OCP\Files\InvalidPathException; use OCP\Files\NotFoundException; @@ -415,7 +416,14 @@ class Node implements \OCP\Files\Node { public function move($targetPath) { $targetPath = $this->normalizePath($targetPath); $parent = $this->root->get(dirname($targetPath)); - if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) { + if ( + $parent instanceof Folder and + $this->isValidPath($targetPath) and + ( + $parent->isCreatable() || + ($parent->getInternalPath() === '' && $parent->getMountPoint() instanceof MoveableMount) + ) + ) { $nonExisting = $this->createNonExistingNode($targetPath); $this->root->emit('\OC\Files', 'preRename', [$this, $nonExisting]); $this->root->emit('\OC\Files', 'preWrite', [$nonExisting]); |