diff options
author | Robin Appelman <robin@icewind.nl> | 2021-01-26 16:07:26 +0100 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2021-03-16 15:22:23 +0100 |
commit | bdd7f28fa6c80133a5f6cb081bf6fe02efad0f9b (patch) | |
tree | cf042dc8c0d51d8c6858e210a3e013772157fb7b | |
parent | f500e2396ebe0744603349eb454c35ff90a3de0e (diff) | |
download | nextcloud-server-bdd7f28fa6c80133a5f6cb081bf6fe02efad0f9b.tar.gz nextcloud-server-bdd7f28fa6c80133a5f6cb081bf6fe02efad0f9b.zip |
only use share cacheentry when available
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/private/Share20/Share.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index a4fbf051413..87f77701ee2 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -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; |