summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_db.erl
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-01-19 22:22:37 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-01-19 22:22:37 +0000
commit8d735cb60ee4ca15dd9f60f916d001c4b9efb675 (patch)
treef23baacf3b9e9f7cc3128bb2c6b6e2d8114d7790 /src/couchdb/couch_httpd_db.erl
parent55e61d341f4c73b7c50ca6bca151d86d1f5f43f5 (diff)
fix for COUCHDB-214 (design docs on dbs with slashes)
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@735850 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_db.erl')
-rw-r--r--src/couchdb/couch_httpd_db.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index cdebb1e3..fc13622d 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -256,9 +256,10 @@ db_req(#httpd{path_parts=[_,<<"_admins">>]}=Req, _Db) ->
% Special case to enable using an unencoded slash in the URL of design docs,
% as slashes in document IDs must otherwise be URL encoded.
db_req(#httpd{method='GET',mochi_req=MochiReq, path_parts=[DbName,<<"_design/",_/binary>>|_]}=Req, _Db) ->
- PathFront = "/" ++ binary_to_list(DbName) ++ "/_design",
- {ok, [PathFront|PathTail]} = regexp:split(MochiReq:get(raw_path),"%2F"),
- RedirectTo = PathFront ++ "/" ++ mochiweb_util:join(PathTail, "%2F"),
+ PathFront = "/" ++ couch_httpd:quote(binary_to_list(DbName)) ++ "/",
+ RawSplit = regexp:split(MochiReq:get(raw_path),"_design%2F"),
+ {ok, [PathFront|PathTail]} = RawSplit,
+ RedirectTo = PathFront ++ "_design/" ++ mochiweb_util:join(PathTail, "%2F"),
couch_httpd:send_response(Req, 301, [{"Location", RedirectTo}], <<>>);
db_req(#httpd{path_parts=[_DbName,<<"_design">>,Name]}=Req, Db) ->