diff options
author | Jan Lehnardt <jan@apache.org> | 2011-09-13 18:54:31 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2011-09-13 18:54:31 +0000 |
commit | 9d93a3ee880bc1a64e9c3e6141c517ed4295661c (patch) | |
tree | 28668fa1120e5789f68c52d983cd949afecce8ad /src/couchdb | |
parent | fb94d04c2dd4a9b39f1e961d4509bf07b07834ef (diff) |
Allow slashes in doc ids in URLs to _update handlers.
This mirrors the behaviour of the _show API.
Patch by Christopher Bonhage.
Closes COUCHDB-1229
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1170299 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r-- | src/couchdb/couch_httpd_show.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/couchdb/couch_httpd_show.erl b/src/couchdb/couch_httpd_show.erl index a215b1da..742b0f20 100644 --- a/src/couchdb/couch_httpd_show.erl +++ b/src/couchdb/couch_httpd_show.erl @@ -106,13 +106,15 @@ get_fun_key(DDoc, Type, Name) -> % send_method_not_allowed(Req, "POST,PUT,DELETE,ETC"); handle_doc_update_req(#httpd{ - path_parts=[_, _, _, _, UpdateName, DocId] + path_parts=[_, _, _, _, UpdateName, DocId|Rest] }=Req, Db, DDoc) -> - Doc = try couch_httpd_db:couch_doc_open(Db, DocId, nil, [conflicts]) + DocParts = [DocId|Rest], + DocId1 = ?l2b(string:join([?b2l(P)|| P <- DocParts], "/")), + Doc = try couch_httpd_db:couch_doc_open(Db, DocId1, nil, [conflicts]) catch _ -> nil end, - send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId); + send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId1); handle_doc_update_req(#httpd{ path_parts=[_, _, _, _, UpdateName] |