]> source.dussan.org Git - nextcloud-server.git/commitdiff
search files by id in shared storages last 15799/head
authorRobin Appelman <robin@icewind.nl>
Tue, 28 May 2019 16:15:52 +0000 (18:15 +0200)
committerBackportbot <backportbot-noreply@rullzer.com>
Wed, 29 May 2019 19:57:31 +0000 (19:57 +0000)
this prevents unneeded recursion when the file is not in the share

Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/View.php

index fa531707648a8c204782ba06584c67b796c0b01d..fef6153fb9ac0fa8aa2b7a55caecaed38257ed7d 100644 (file)
@@ -49,6 +49,7 @@ use Icewind\Streams\CallbackWrapper;
 use OC\Files\Mount\MoveableMount;
 use OC\Files\Storage\Storage;
 use OC\User\User;
+use OCA\Files_Sharing\SharedMount;
 use OCP\Constants;
 use OCP\Files\Cache\ICacheEntry;
 use OCP\Files\EmptyFileNameException;
@@ -1718,6 +1719,13 @@ class View {
                // reverse the array so we start with the storage this view is in
                // which is the most likely to contain the file we're looking for
                $mounts = array_reverse($mounts);
+
+               // put non shared mounts in front of the shared mount
+               // this prevent unneeded recursion into shares
+               usort($mounts, function(IMountPoint $a, IMountPoint $b) {
+                       return $a instanceof SharedMount && (!$b instanceof SharedMount) ? 1 : -1;
+               });
+
                foreach ($mounts as $mount) {
                        /**
                         * @var \OC\Files\Mount\MountPoint $mount