Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2019-03-14 17:27:25 +0300
committerRobin Appelman <robin@icewind.nl>2019-03-14 17:27:25 +0300
commit3ca1e900446d5d014beffd78c64990ee96540120 (patch)
tree5320357882f1356fb03086d2b5963e56c0a291b7 /lib
parent762a8bb3d9521a9f75d9e186150cb77241b3bc19 (diff)
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')
-rw-r--r--lib/private/Files/Node/Node.php10
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]);