]> source.dussan.org Git - nextcloud-server.git/commitdiff
only get the permissions from the share source if it's not already cached 22744/head
authorRobin Appelman <robin@icewind.nl>
Wed, 9 Sep 2020 11:48:48 +0000 (13:48 +0200)
committerRobin Appelman <robin@icewind.nl>
Wed, 9 Sep 2020 11:48:48 +0000 (13:48 +0200)
this prevents having to setup the share source when doing metadata stuff on the share root

Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/Cache.php

index 587d49f4a46b53e4ccbcdaa04acf8ce582ec2359..dae33376f6d5c87f7fe5fb3f9c53fb99f43361c5 100644 (file)
@@ -146,17 +146,16 @@ class Cache extends CacheJail {
                }
 
                try {
-                       $sharePermissions = $this->storage->getPermissions($entry['path']);
+                       if (isset($entry['permissions'])) {
+                               $entry['permissions'] &= $this->storage->getShare()->getPermissions();
+                       } else {
+                               $entry['permissions'] = $this->storage->getPermissions($entry['path']);
+                       }
                } catch (StorageNotAvailableException $e) {
                        // thrown by FailedStorage e.g. when the sharer does not exist anymore
                        // (IDE may say the exception is never thrown – false negative)
                        $sharePermissions = 0;
                }
-               if (isset($entry['permissions'])) {
-                       $entry['permissions'] &= $sharePermissions;
-               } else {
-                       $entry['permissions'] = $sharePermissions;
-               }
                $entry['uid_owner'] = $this->storage->getOwner('');
                $entry['displayname_owner'] = $this->getOwnerDisplayName();
                if ($path === '') {