Skip to content

Commit

Permalink
only use share cacheentry when available
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 authored and backportbot[bot] committed Mar 15, 2021
1 parent 3e8e79d commit 1619f43
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/private/Share20/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

namespace OC\Share20;

use OCP\Files\File;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\FileInfo;
use OCP\Files\IRootFolder;
Expand Down Expand Up @@ -233,8 +234,13 @@ public function setNodeType($type) {
*/
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;
Expand Down

0 comments on commit 1619f43

Please sign in to comment.