From 2b845a726863637aceb0c812be1d324ac6ab7074 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 28 May 2019 18:15:52 +0200 Subject: [PATCH] search files by id in shared storages last this prevents unneeded recursion when the file is not in the share Signed-off-by: Robin Appelman --- lib/private/Files/View.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index b43ad92908329..990bd07e59c4b 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -49,6 +49,7 @@ 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; @@ -1715,6 +1716,13 @@ public function getPath($id) { // 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