only use share cacheentry when available

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-01-26 16:07:26 +01:00 committed by Daniel Kesselberg
parent 1d1d4de991
commit b2903064c9
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
1 changed files with 8 additions and 2 deletions

View File

@ -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;