diff options
author | Robert Newson <robert.newson@cloudant.com> | 2011-06-22 15:10:13 -0400 |
---|---|---|
committer | Robert Newson <robert.newson@cloudant.com> | 2011-06-22 15:10:13 -0400 |
commit | e2e9e07398c9697a13f6db36ed9d0403fa6c89f1 (patch) | |
tree | 39faca2adc29ad57c0084c942f1c2eb6ba08774d /apps/couch/src/couch_httpd_db.erl | |
parent | ca738083b0a5053a1402b8eac55d6228b6e952b2 (diff) | |
parent | d8dc16093a26c53407d8bf702698848104ba01d6 (diff) |
Merge remote-tracking branch 'upstream/1.1.x' into 0.4.x
Conflicts:
acinclude.m4.in
apps/couch/src/couch_app.erl
apps/couch/src/couch_doc.erl
apps/couch/src/couch_view.erl
configure.ac
share/www/script/test/replicator_db.js
src/erlang-oauth/Makefile.am
test/etap/Makefile.am
Diffstat (limited to 'apps/couch/src/couch_httpd_db.erl')
-rw-r--r-- | apps/couch/src/couch_httpd_db.erl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/couch/src/couch_httpd_db.erl b/apps/couch/src/couch_httpd_db.erl index e3638b25..71204598 100644 --- a/apps/couch/src/couch_httpd_db.erl +++ b/apps/couch/src/couch_httpd_db.erl @@ -692,12 +692,18 @@ db_doc_req(#httpd{method='PUT'}=Req, Db, DocId) -> RespHeaders = [{"Location", Loc}], case couch_util:to_list(couch_httpd:header_value(Req, "Content-Type")) of ("multipart/related;" ++ _) = ContentType -> - {ok, Doc0, WaitFun} = couch_doc:doc_from_multi_part_stream( + {ok, Doc0, WaitFun, Parser} = couch_doc:doc_from_multi_part_stream( ContentType, fun() -> receive_request_data(Req) end), Doc = couch_doc_from_req(Req, DocId, Doc0), - Result = update_doc(Req, Db, DocId, Doc, RespHeaders, UpdateType), - WaitFun(), - Result; + try + Result = update_doc(Req, Db, DocId, Doc, RespHeaders, UpdateType), + WaitFun(), + Result + catch throw:Err -> + % Document rejected by a validate_doc_update function. + couch_doc:abort_multi_part_stream(Parser), + throw(Err) + end; _Else -> case couch_httpd:qs_value(Req, "batch") of "ok" -> |