handle case where fileid is not set

This commit is contained in:
Thomas Müller 2013-10-23 16:40:29 +02:00
parent b60ae11db8
commit b02a485712
2 changed files with 12 additions and 4 deletions

View File

@ -59,7 +59,10 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
unset($requestedProperties[array_search($fileid_propertyname, $requestedProperties)]);
/** @var $node OC_Connector_Sabre_Node */
$returnedProperties[200][$fileid_propertyname] = $node->getFileId();
$fileId = $node->getFileId();
if (!is_null($fileId)) {
$returnedProperties[200][$fileid_propertyname] = $fileId;
}
}

View File

@ -272,8 +272,13 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
public function getFileId()
{
$this->getFileinfoCache();
$instanceId = OC_Util::getInstanceId();
$id = sprintf('%08d', $this->fileinfo_cache['fileid']);
return $instanceId . $id;
if (isset($this->fileinfo_cache['fileid'])) {
$instanceId = OC_Util::getInstanceId();
$id = sprintf('%08d', $this->fileinfo_cache['fileid']);
return $instanceId . $id;
}
return null;
}
}