1.x compat: update fun: allow docs with slash in id
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/5d08f62f Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/5d08f62f Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/5d08f62f Branch: refs/heads/1.x-compat Commit: 5d08f62f8aa3e858c2c707ade2b96a26d90e900c Parents: 6421adc Author: Jan Lehnardt <[email protected]> Authored: Sat Dec 12 15:14:37 2015 +0100 Committer: Jan Lehnardt <[email protected]> Committed: Sat Dec 12 15:14:37 2015 +0100 ---------------------------------------------------------------------- src/chttpd_show.erl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/5d08f62f/src/chttpd_show.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_show.erl b/src/chttpd_show.erl index d049756..787df16 100644 --- a/src/chttpd_show.erl +++ b/src/chttpd_show.erl @@ -99,15 +99,16 @@ show_etag(#httpd{user_ctx=UserCtx}=Req, Doc, DDoc, More) -> % send_method_not_allowed(Req, "POST,PUT,DELETE,ETC"); handle_doc_update_req(#httpd{ - path_parts=[_, _, _, _, UpdateName, DocId] + path_parts=[_, _, _, _, UpdateName] }=Req, Db, DDoc) -> - Doc = maybe_open_doc(Db, DocId), - send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId); + send_doc_update_response(Req, Db, DDoc, UpdateName, nil, null); handle_doc_update_req(#httpd{ - path_parts=[_, _, _, _, UpdateName] + path_parts=[_, _, _, _, UpdateName | DocIdParts] }=Req, Db, DDoc) -> - send_doc_update_response(Req, Db, DDoc, UpdateName, nil, null); + DocId = ?l2b(string:join([?b2l(P) || P <- DocIdParts], "/")), + Doc = maybe_open_doc(Db, DocId), + send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId); handle_doc_update_req(Req, _Db, _DDoc) -> chttpd:send_error(Req, 404, <<"update_error">>, <<"Invalid path.">>).
