From 757076af29469fe919c56dc043e54f33d71e8e2c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 3 Jan 2025 17:41:39 +0100 Subject: fix: explicitly ignore nested mounts when transfering ownership Signed-off-by: Robin Appelman --- lib/private/Files/View.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/private/Files/View.php') diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 03bafd2e635..072d3520ae9 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -700,11 +700,14 @@ class View { * * @param string $source source path * @param string $target target path + * @param array $options * * @return bool|mixed * @throws LockedException */ - public function rename($source, $target) { + public function rename($source, $target, array $options = []) { + $checkSubMounts = $options['checkSubMounts'] ?? true; + $absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($source)); $absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($target)); @@ -772,13 +775,16 @@ class View { try { $this->changeLock($target, ILockingProvider::LOCK_EXCLUSIVE, true); - $movedMounts = $mountManager->findIn($this->getAbsolutePath($source)); + if ($checkSubMounts) { + $movedMounts = $mountManager->findIn($this->getAbsolutePath($source)); + } else { + $movedMounts = []; + } if ($internalPath1 === '') { $sourceParentMount = $this->getMount(dirname($source)); $movedMounts[] = $mount1; $this->validateMountMove($movedMounts, $sourceParentMount, $mount2, !$this->targetIsNotShared($targetUser, $absolutePath2)); - /** * @var \OC\Files\Mount\MountPoint | \OC\Files\Mount\MoveableMount $mount1 */ -- cgit v1.2.3