(fix) avoid saving non-parsable events/tasks

This commit is contained in:
Ludovic Marcotte
2018-10-09 14:47:22 -04:00
parent 8120a48b95
commit 995ccb2b73
2 changed files with 17 additions and 0 deletions

View File

@@ -2503,6 +2503,14 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
rq = [_ctx request];
rqCalendar = [iCalCalendar parseSingleFromSource: [rq contentAsString]];
// We are unable to parse the received calendar, we return right away
// with a 400 error code.
if (!rqCalendar)
{
return [NSException exceptionWithHTTPStatus: 400
reason: @"Unable to parse event."];
}
if (![self isNew])
{

View File

@@ -118,6 +118,15 @@
rq = [_ctx request];
rqCalendar = [iCalCalendar parseSingleFromSource: [rq contentAsString]];
// We are unable to parse the received calendar, we return right away
// with a 400 error code.
if (!rqCalendar)
{
return [NSException exceptionWithHTTPStatus: 400
reason: @"Unable to parse task."];
}
[self adjustClassificationInRequestCalendar: rqCalendar];
[rq setContent: [[rqCalendar versitString] dataUsingEncoding: [rq contentEncoding]]];