WebDAV: handle 412 response to delete
Radicale reports 412 'Preconditiona Failed' instead of 404 when asked to delete a non-existent item. Translate that into the 404 expected by the Synthesis engine. Found when running Client::Source test against Radicale 0.7-7-g186c59c.
This commit is contained in:
parent
5e82815b5c
commit
fdaf27f7e5
|
@ -1501,8 +1501,19 @@ void WebDAVSource::removeItem(const string &uid)
|
|||
// TODO: match exactly the expected revision, aka ETag,
|
||||
// or implement locking.
|
||||
// req.addHeader("If-Match", etag);
|
||||
if (req->run()) {
|
||||
break;
|
||||
try {
|
||||
if (req->run()) {
|
||||
break;
|
||||
}
|
||||
} catch (const TransportStatusException &ex) {
|
||||
if (ex.syncMLStatus() == 412) {
|
||||
// Radicale reports 412 'Precondition Failed'. Hmm, okay.
|
||||
// Let's map it to the expected 404.
|
||||
SE_THROW_EXCEPTION_STATUS(TransportStatusException,
|
||||
"object not found (was 412 'Precondition Failed')",
|
||||
SyncMLStatus(404));
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
SE_LOG_DEBUG(NULL, NULL, "remove item status: %s",
|
||||
|
|
Loading…
Reference in a new issue