summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorBenoit Chesneau <benoitc@apache.org>2010-02-04 09:55:56 +0000
committerBenoit Chesneau <benoitc@apache.org>2010-02-04 09:55:56 +0000
commit88c27f28fa212b1bb7e9fbd3da4fd70e34965cf3 (patch)
tree395d03380ed0b7b5c239d2f84991909e26be2fbc /src/couchdb
parent17632461e3ea7007594783c39a25055fa0ccdffe (diff)
fix COUCHDB-638.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@906423 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_httpd_show.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/couchdb/couch_httpd_show.erl b/src/couchdb/couch_httpd_show.erl
index 467c0a42..467b502b 100644
--- a/src/couchdb/couch_httpd_show.erl
+++ b/src/couchdb/couch_httpd_show.erl
@@ -21,11 +21,15 @@
[send_json/2,send_json/3,send_json/4,send_method_not_allowed/2,
start_json_response/2,send_chunk/2,last_chunk/1,send_chunked_error/2,
start_chunked_response/3, send_error/4]).
+
+
% /db/_design/foo/show/bar/docid
% show converts a json doc to a response of any content-type.
% it looks up the doc an then passes it to the query server.
% then it sends the response from the query server to the http client.
+
+
handle_doc_show_req(#httpd{
path_parts=[_, _, _, _, ShowName, DocId]
}=Req, Db, DDoc) ->
@@ -36,6 +40,20 @@ handle_doc_show_req(#httpd{
handle_doc_show(Req, Db, DDoc, ShowName, Doc);
handle_doc_show_req(#httpd{
+ path_parts=[_, _, _, _, ShowName, DocId|Rest]
+ }=Req, Db, DDoc) ->
+
+ DocParts = [DocId|Rest],
+ DocId1 = string:join([?b2l(P)|| P <- DocParts], "/"),
+
+ % open the doc
+ Doc = couch_httpd_db:couch_doc_open(Db, ?l2b(DocId1), nil, [conflicts]),
+ % we don't handle revs here b/c they are an internal api
+ % returns 404 if there is no doc with DocId
+ handle_doc_show(Req, Db, DDoc, ShowName, Doc);
+
+
+handle_doc_show_req(#httpd{
path_parts=[_, _, _, _, ShowName]
}=Req, Db, DDoc) ->
% with no docid the doc is nil