fix: Ignored processing delete calendar requests

This commit is contained in:
Aerex 2020-08-23 17:39:56 -05:00
parent bf9a55de0e
commit 444db318e7
2 changed files with 9 additions and 2 deletions

View File

@ -188,10 +188,13 @@ class Plugin extends ServerPlugin {
$body = $request->getBodyAsString(); $body = $request->getBodyAsString();
$path = $request->getPath(); $path = $request->getPath();
$paths = explode('/', $path); $paths = explode('/', $path);
if (sizeof($paths) > 1) { if (isset($paths) && sizeof($paths) > 1) {
$uid = str_replace('.ics', '', $paths[sizeof($paths)-1]); $uid = str_replace('.ics', '', $paths[sizeof($paths)-1]);
// Check if deleting an ics file
if ($uid != '') {
$this->storageManager->remove($uid); $this->storageManager->remove($uid);
} }
}
} catch(BadRequest $e){ } catch(BadRequest $e){
throw new BadRequest($e->getMessage(), null, $e); throw new BadRequest($e->getMessage(), null, $e);
} catch(\Exception $e){ } catch(\Exception $e){

View File

@ -209,6 +209,10 @@ class Taskwarrior implements IStorage {
try { try {
$this->logger->info(sprintf('Deleting iCal %s from taskwarrior', $uid)); $this->logger->info(sprintf('Deleting iCal %s from taskwarrior', $uid));
$this->refresh(); $this->refresh();
if (!array_key_exists((string)$uid, $this->tasks)) {
$this->logger->warn(sprintf('Could not find task %s to delete. Skipping', (string)$uid));
return;
}
$task = $this->tasks[(string)$uid]; $task = $this->tasks[(string)$uid];
if (isset($task) && $task['status'] !== 'deleted') { if (isset($task) && $task['status'] !== 'deleted') {
$uuid = $task['uuid']; $uuid = $task['uuid'];