Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
only use share cacheentry when available
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and backportbot[bot] committed Mar 15, 2021
commit e5ffb96c36f89113fcca8e0f5bdfdb98040186b6
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