Skip to content

Commit 925e121

Browse files
authored
Merge pull request #15800 from nextcloud/backport/15776/stable15
[stable15] search files by id in shared storages last
2 parents 9037373 + 2b845a7 commit 925e121

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/private/Files/View.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
use OC\Files\Mount\MoveableMount;
5050
use OC\Files\Storage\Storage;
5151
use OC\User\User;
52+
use OCA\Files_Sharing\SharedMount;
5253
use OCP\Constants;
5354
use OCP\Files\Cache\ICacheEntry;
5455
use OCP\Files\EmptyFileNameException;
@@ -1715,6 +1716,13 @@ public function getPath($id) {
17151716
// reverse the array so we start with the storage this view is in
17161717
// which is the most likely to contain the file we're looking for
17171718
$mounts = array_reverse($mounts);
1719+
1720+
// put non shared mounts in front of the shared mount
1721+
// this prevent unneeded recursion into shares
1722+
usort($mounts, function(IMountPoint $a, IMountPoint $b) {
1723+
return $a instanceof SharedMount && (!$b instanceof SharedMount) ? 1 : -1;
1724+
});
1725+
17181726
foreach ($mounts as $mount) {
17191727
/**
17201728
* @var \OC\Files\Mount\MountPoint $mount

0 commit comments

Comments
 (0)