From d8d42ab3838a04084c6813fef65c2a8eaff51948 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 24 Sep 2010 12:35:50 +1200 Subject: [PATCH] Convert error responses to use CalDAVRequest::PreconditionFailed() --- inc/caldav-PUT-vcard.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/caldav-PUT-vcard.php b/inc/caldav-PUT-vcard.php index f7a14625..e22572df 100644 --- a/inc/caldav-PUT-vcard.php +++ b/inc/caldav-PUT-vcard.php @@ -27,17 +27,17 @@ $dest = new DAVResource($request->path); $container = $dest->FetchParentContainer(); if ( ! $dest->Exists() ) { if ( $container->IsPrincipal() ) { - $request->DoResponse(403,translate('A DAViCal principal collection may only contain collections')); + $request->PreconditionFailed(405,'method-not-allowed',translate('A DAViCal principal collection may only contain collections')); } if ( ! $container->Exists() ) { - $request->DoResponse( 409, translate('Destination collection does not exist') ); + $request->PreconditionFailed( 409, 'collection-must-exist',translate('The destination collection does not exist') ); } $container->NeedPrivilege('DAV::bind'); } else { if ( $dest->IsCollection() ) { if ( ! isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections ) { - $request->DoResponse(403,translate('You may not PUT to a collection URL')); + $request->PreconditionFailed(405,'method-not-allowed',translate('You may not PUT to a collection URL')); } $request->DoResponse(403,translate('PUT on a collection is only allowed for text/calendar content against a calendar collection')); } @@ -45,11 +45,11 @@ else { } if ( isset($request->etag_none_match) && $request->etag_none_match != '*' && $dest->Exists() ) { - $request->DoResponse(412); + $request->PreconditionFailed(412,'if-none-match', translate('A resource already exists at that URL')); } if ( isset($request->etag_if_match) && $request->etag_if_match != $dest->unique_tag() ) { - $request->DoResponse(412); + $request->PreconditionFailed(412,'if-match',sprintf('Existing resource ETag of "%s" does not match "%s"', $dest->unique_tag(), $request->etag_if_match) ); } $collection_id = $container->GetProperty('collection_id');