aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Share20
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-01-26 16:07:26 +0100
committerRobin Appelman <robin@icewind.nl>2021-01-26 16:22:00 +0100
commit6ecf33bfe7ef719cd979de5b29fc1da02e255632 (patch)
treebf684e50c9cbfbe4823d2d0699b14c317faeea27 /lib/private/Share20
parente511a539b7e2348a2ed0cf8dbfc34ab9a69240f1 (diff)
downloadnextcloud-server-6ecf33bfe7ef719cd979de5b29fc1da02e255632.tar.gz
nextcloud-server-6ecf33bfe7ef719cd979de5b29fc1da02e255632.zip
only use share cacheentry when available
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Share20')
-rw-r--r--lib/private/Share20/Share.php10
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;