Skip to content

Commit

Permalink
fix(dav): render DAV exceptions as XML
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Jan 27, 2022
1 parent 28634b9 commit 2e58ddf
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions SoObjects/SOGo/SOGoObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,8 @@ - (id) GETAction: (id) localContext
value = [self _webDAVResponse: localContext];
}
else
value = [NSException exceptionWithHTTPStatus: 501 /* not implemented */
reason: @"no WebDAV GET support?!"];
value = [NSException exceptionWithDAVStatus: 501 /* not implemented */
reason: @"no WebDAV GET support?!"];
}
else
{
Expand Down Expand Up @@ -741,8 +741,8 @@ - (NSException *)checkIfMatchCondition:(NSString *)_c inContext:(id)_ctx {
// TODO: we might want to return the davEntityTag in the response
[self debugWithFormat:@"etag '%@' does not match: %@", etag,
[etags componentsJoinedByString:@","]];
return [NSException exceptionWithHTTPStatus:412 /* Precondition Failed */
reason:@"Precondition Failed"];
return [NSException exceptionWithDAVStatus: 412 /* Precondition Failed */
reason:@"Precondition Failed"];
}

- (NSException *)checkIfNoneMatchCondition:(NSString *)_c inContext:(id)_ctx {
Expand Down Expand Up @@ -771,8 +771,8 @@ - (NSException *)checkIfNoneMatchCondition:(NSString *)_c inContext:(id)_ctx {
[self debugWithFormat:@"etag '%@' matches: %@", etag,
[etags componentsJoinedByString:@","]];
/* one etag matches, so stop the request */
return [NSException exceptionWithHTTPStatus:304 /* Not Modified */
reason:@"object was not modified"];
return [NSException exceptionWithDAVStatus: 304 /* Not Modified */
reason: @"object was not modified"];
}

return nil;
Expand Down Expand Up @@ -1553,11 +1553,8 @@ - (NSException *) davSetProperties: (NSDictionary *) setProps
withObject: currentValue];
}
else
exception
= [NSException exceptionWithHTTPStatus: 403
reason: [NSString stringWithFormat:
@"Property '%@' cannot be set.",
currentProp]];
exception = [NSException exceptionWithDAVStatus: 403
reason: [NSString stringWithFormat: @"Property '%@' cannot be set.", currentProp]];
}

return exception;
Expand Down

0 comments on commit 2e58ddf

Please sign in to comment.