/**
  * Returns the node type, either 'dir' or 'file'
  *
  * If there is a problem, we return an empty string so that the node can be ignored
  *
  * @param Node $node
  *
  * @return string
  */
 protected function getNodeType($node)
 {
     try {
         $nodeType = $node->getType();
     } catch (\Exception $exception) {
         return '';
     }
     return $nodeType;
 }
 /**
  * Returns the path which goes from the file, up to the root folder of the Gallery:
  * current_folder/my_file
  *
  * That root folder changes when folders are shared publicly
  *
  * @param File|Folder|Node $node
  *
  * @return string
  */
 public function getPathFromVirtualRoot($node)
 {
     $path = $node->getPath();
     $nodeType = $node->getType();
     // Needed because fromRootToFolder always ends with a slash
     if ($nodeType === 'dir') {
         $path .= '/';
     }
     $path = str_replace($this->fromRootToFolder, '', $path);
     $path = rtrim($path, '/');
     return $path;
 }