namespace OC\Share20;
+use OCP\Files\File;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\FileInfo;
use OCP\Files\IRootFolder;
*/
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;