From f8331aab2d86647e09bf7afd02026311c682e507 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 8 Dec 2009 09:24:34 +1300 Subject: [PATCH] Fix handling of DELETE followed by CREATE case. --- inc/caldav-REPORT-sync-collection.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inc/caldav-REPORT-sync-collection.php b/inc/caldav-REPORT-sync-collection.php index 739437fe..b70903c6 100644 --- a/inc/caldav-REPORT-sync-collection.php +++ b/inc/caldav-REPORT-sync-collection.php @@ -72,7 +72,7 @@ if ( $qry->Exec("REPORT",__LINE__,__FILE__) ) { if ( $object->dav_id == $last_dav_id ) { /** The complex case: this is the second or subsequent for this dav_id */ if ( $object->sync_status == 404 ) { - if ( $first_action == 201 ) { + if ( $first_status == 201 ) { array_pop($responses); $last_dav_id = -1; $first_status = 0; @@ -87,6 +87,15 @@ if ( $qry->Exec("REPORT",__LINE__,__FILE__) ) { $first_status = 404; } } + else if ( $object->sync_status == 201 && $first_status == 404 ) { + // ... Delete ... Create ... is indicated as a create, but don't forget we started with a delete + array_pop($responses); + $resultset = array( + new XMLElement( 'href', ConstructURL($object->dav_name) ), + new XMLElement( 'status', display_status($object->sync_status) ) + ); + $responses[] = new XMLElement( 'sync-response', $resultset ); + } /** Else: * the object existed at start and we have multiple modifications, * or,