diff options
author | Robin Appelman <robin@icewind.nl> | 2019-03-14 15:52:38 +0100 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2019-03-20 10:00:03 +0000 |
commit | d47106cdccf61b84f161dfee1983049c76d79f12 (patch) | |
tree | 307852faa75f536a1fb8fe4d928279761a8c3b01 | |
parent | 863e17d4e635241e547443b50d6c4ccdd92168e8 (diff) | |
download | nextcloud-server-d47106cdccf61b84f161dfee1983049c76d79f12.tar.gz nextcloud-server-d47106cdccf61b84f161dfee1983049c76d79f12.zip |
always allow moving mountpoints inside the same mountpoint
even if that mountpoint isn't normally a valid target for moving mounts into
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/private/Files/View.php | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 6066aed411f..b43ad929083 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -59,6 +59,7 @@ use OCP\Files\InvalidPathException; use OCP\Files\Mount\IMountPoint; use OCP\Files\NotFoundException; use OCP\Files\ReservedWordException; +use OCP\Files\Storage\IStorage; use OCP\ILogger; use OCP\IUser; use OCP\Lock\ILockingProvider; @@ -786,7 +787,8 @@ class View { if ($internalPath1 === '') { if ($mount1 instanceof MoveableMount) { - if ($this->isTargetAllowed($absolutePath2)) { + $sourceParentMount = $this->getMount(dirname($path1)); + if ($sourceParentMount === $mount2 && $this->targetIsNotShared($storage2, $internalPath2)) { /** * @var \OC\Files\Mount\MountPoint | \OC\Files\Mount\MoveableMount $mount1 */ @@ -1750,18 +1752,11 @@ class View { * It is not allowed to move a mount point into a different mount point or * into an already shared folder * - * @param string $target path + * @param IStorage $targetStorage + * @param string $targetInternalPath * @return boolean */ - private function isTargetAllowed($target) { - - list($targetStorage, $targetInternalPath) = \OC\Files\Filesystem::resolvePath($target); - if (!$targetStorage->instanceOfStorage('\OCP\Files\IHomeStorage')) { - \OCP\Util::writeLog('files', - 'It is not allowed to move one mount point into another one', - ILogger::DEBUG); - return false; - } + private function targetIsNotShared(IStorage $targetStorage, string $targetInternalPath) { // note: cannot use the view because the target is already locked $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |