Skip to content

Commit 49a0996

Browse files
icewind1991backportbot[bot]
authored andcommitted
fix: explicitly ignore nested mounts when transfering ownership
Signed-off-by: Robin Appelman <robin@icewind.nl> [skip ci]
1 parent 6e58028 commit 49a0996

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function isDeletable($path) {
4141
return $this->deletables[$path];
4242
}
4343

44-
public function rename($path1, $path2) {
44+
public function rename($path1, $path2, array $options = []) {
4545
return $this->canRename;
4646
}
4747

build/integration/files_features/transfer-ownership.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ Feature: transfer-ownership
514514
And user "user2" accepts last share
515515
When transferring ownership of path "test" from "user0" to "user1"
516516
Then the command failed with exit code 1
517-
And the command output contains the text "Could not transfer files."
517+
And the command error output contains the text "Moving a storage (user0/files/test) into another storage (user1) is not allowed"
518518

519519
Scenario: transferring ownership does not transfer received shares
520520
Given user "user0" exists

lib/private/Files/View.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,11 +692,14 @@ public function deleteAll($directory) {
692692
*
693693
* @param string $source source path
694694
* @param string $target target path
695+
* @param array $options
695696
*
696697
* @return bool|mixed
697698
* @throws LockedException
698699
*/
699-
public function rename($source, $target) {
700+
public function rename($source, $target, array $options = []) {
701+
$checkSubMounts = $options['checkSubMounts'] ?? true;
702+
700703
$absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($source));
701704
$absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($target));
702705

@@ -764,13 +767,16 @@ public function rename($source, $target) {
764767
try {
765768
$this->changeLock($target, ILockingProvider::LOCK_EXCLUSIVE, true);
766769

767-
$movedMounts = $mountManager->findIn($this->getAbsolutePath($source));
770+
if ($checkSubMounts) {
771+
$movedMounts = $mountManager->findIn($this->getAbsolutePath($source));
772+
} else {
773+
$movedMounts = [];
774+
}
768775

769776
if ($internalPath1 === '') {
770777
$sourceParentMount = $this->getMount(dirname($source));
771778
$movedMounts[] = $mount1;
772779
$this->validateMountMove($movedMounts, $sourceParentMount, $mount2, !$this->targetIsNotShared($targetUser, $absolutePath2));
773-
774780
/**
775781
* @var \OC\Files\Mount\MountPoint | \OC\Files\Mount\MoveableMount $mount1
776782
*/

0 commit comments

Comments
 (0)