Skip to content

Commit 3723e15

Browse files
icewind1991AndyScherzinger
authored andcommitted
fix: explicitly ignore nested mounts when transfering ownership
Signed-off-by: Robin Appelman <robin@icewind.nl> [skip ci]
1 parent 4a9a2da commit 3723e15

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

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

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

65-
public function rename($path1, $path2) {
65+
public function rename($path1, $path2, array $options = []) {
6666
return $this->canRename;
6767
}
6868

build/integration/features/transfer-ownership.feature

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

516516
Scenario: transferring ownership does not transfer received shares
517517
Given user "user0" exists

lib/private/Files/View.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,11 +728,14 @@ public function deleteAll($directory) {
728728
*
729729
* @param string $source source path
730730
* @param string $target target path
731+
* @param array $options
731732
*
732733
* @return bool|mixed
733734
* @throws LockedException
734735
*/
735-
public function rename($source, $target) {
736+
public function rename($source, $target, array $options = []) {
737+
$checkSubMounts = $options['checkSubMounts'] ?? true;
738+
736739
$absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($source));
737740
$absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($target));
738741

@@ -791,7 +794,11 @@ public function rename($source, $target) {
791794
try {
792795
$this->changeLock($target, ILockingProvider::LOCK_EXCLUSIVE, true);
793796

794-
$movedMounts = $mountManager->findIn($this->getAbsolutePath($source));
797+
if ($checkSubMounts) {
798+
$movedMounts = $mountManager->findIn($this->getAbsolutePath($source));
799+
} else {
800+
$movedMounts = [];
801+
}
795802

796803
if ($internalPath1 === '') {
797804
if ($mount1 instanceof MoveableMount) {

0 commit comments

Comments
 (0)