fix: Generalized import cal events not from source storages

This commit is contained in:
Aerex
2020-09-28 23:48:55 -05:00
parent 0a01e6e905
commit 4140ded5b3
2 changed files with 19 additions and 3 deletions

View File

@@ -51,8 +51,12 @@ class Plugin extends ServerPlugin {
}
private function getDisplayName($path) {
$node = $this->server->tree->getNodeForPath($path);
$propFind = new PropFind($path, []);
// Remove filepath
$urlParts = explode('/', $path);
$calendarUrl = implode('/', array_slice($urlParts, 0, count($urlParts)-1));
$node = $this->server->tree->getNodeForPath($calendarUrl);
$propFind = new PropFind($calendarUrl, []);
$properties = $this->server->getPropertiesByNode($propFind, $node);
return $properties['d:displayname'] ?? '';
@@ -138,7 +142,7 @@ class Plugin extends ServerPlugin {
$vCal = \Sabre\VObject\Reader::read($body);
$displayname = $this->getDisplayName($request->getPath());
try {
if (!stristr($vCal->PRODID, 'taskwarrior')) {
if (!$this->storageManager->fromStorageSource($vCal)) {
$this->storageManager->import($vCal, $displayname);
}
} catch(BadRequest $e){