]> source.dussan.org Git - nextcloud-server.git/commitdiff
only use share cacheentry when available 26134/head
authorRobin Appelman <robin@icewind.nl>
Tue, 26 Jan 2021 15:07:26 +0000 (16:07 +0100)
committerDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 16 Mar 2021 14:22:23 +0000 (15:22 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Share20/Share.php

index a4fbf05141376aa1284c89e99e4f84c02a281fd2..87f77701ee20908bcdee636fa89c385a08dadcae 100644 (file)
@@ -30,6 +30,7 @@
 
 namespace OC\Share20;
 
+use OCP\Files\File;
 use OCP\Files\Cache\ICacheEntry;
 use OCP\Files\FileInfo;
 use OCP\Files\IRootFolder;
@@ -233,8 +234,13 @@ class Share implements \OCP\Share\IShare {
         */
        public function getNodeType() {
                if ($this->nodeType === null) {
-                       $info = $this->getNodeCacheEntry();
-                       $this->nodeType = $info->getMimeType() === FileInfo::MIMETYPE_FOLDER ? 'folder' : 'file';
+                       if ($this->getNodeCacheEntry()) {
+                               $info = $this->getNodeCacheEntry();
+                               $this->nodeType = $info->getMimeType() === FileInfo::MIMETYPE_FOLDER ? 'folder' : 'file';
+                       } else {
+                               $node = $this->getNode();
+                               $this->nodeType = $node instanceof File ? 'file' : 'folder';
+                       }
                }
 
                return $this->nodeType;