diff --git a/imap/http_dav.c b/imap/http_dav.c index 8c783d5c97..f67eaa82e3 100644 --- a/imap/http_dav.c +++ b/imap/http_dav.c @@ -113,6 +113,9 @@ static const struct dav_namespace_t { { XML_NS_SYSFLAG, "SF" }, }; +#define NUM_KNOWN_NAMESPACES \ + (sizeof(known_namespaces) / sizeof(struct dav_namespace_t)) + static const struct match_type_t dav_match_types[] = { { "contains", MATCH_TYPE_CONTAINS }, { "equals", MATCH_TYPE_EQUALS }, @@ -3702,6 +3705,7 @@ static int do_proppatch(struct proppatch_ctx *pctx, xmlNodePtr instr) entry++); if (entry->name) { + prop->ns = pctx->ns[entry->ns]; int rights = httpd_myrights(httpd_authstate, pctx->txn->req_tgt.mbentry); if (!entry->put) { @@ -3738,7 +3742,14 @@ static int do_proppatch(struct proppatch_ctx *pctx, xmlNodePtr instr) } else if (pctx->txn->req_tgt.namespace->id != URL_NS_PRINCIPAL) { /* Write "dead" property */ - proppatch_todb(prop, set, pctx, propstat, NULL); + for (size_t i = 0; i < NUM_KNOWN_NAMESPACES; i++) { + if (!strcmp((const char *) prop->ns->href, + known_namespaces[i].href)) { + prop->ns = pctx->ns[i]; + break; + } + } + proppatch_todb_internal(prop, set, pctx, propstat, NULL, 1); } } }