Browse Source

only use share cacheentry when available

Signed-off-by: Robin Appelman <robin@icewind.nl>
tags/v22.0.0beta1
Robin Appelman 3 years ago
parent
commit
6ecf33bfe7
No account linked to committer's email address
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      lib/private/Share20/Share.php

+ 8
- 2
lib/private/Share20/Share.php 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;

Loading…
Cancel
Save