Skip to content

Commit 4f7d650

Browse files
committed
only use share cacheentry when available
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent e511a53 commit 4f7d650

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/private/Share20/Share.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
namespace OC\Share20;
3232

33+
use OC\Files\Node\File;
3334
use OCP\Files\Cache\ICacheEntry;
3435
use OCP\Files\FileInfo;
3536
use OCP\Files\IRootFolder;
@@ -233,8 +234,13 @@ public function setNodeType($type) {
233234
*/
234235
public function getNodeType() {
235236
if ($this->nodeType === null) {
236-
$info = $this->getNodeCacheEntry();
237-
$this->nodeType = $info->getMimeType() === FileInfo::MIMETYPE_FOLDER ? 'folder' : 'file';
237+
if ($this->getNodeCacheEntry()) {
238+
$info = $this->getNodeCacheEntry();
239+
$this->nodeType = $info->getMimeType() === FileInfo::MIMETYPE_FOLDER ? 'folder' : 'file';
240+
} else {
241+
$node = $this->getNode();
242+
$this->nodeType = $node instanceof File ? 'file' : 'folder';
243+
}
238244
}
239245

240246
return $this->nodeType;

0 commit comments

Comments
 (0)