summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Touzet <joant@atypical.net>2020-01-31 19:02:10 -0500
committerJoan Touzet <joant@atypical.net>2020-01-31 19:51:47 -0500
commit674683a7cfad4b5befd5a9002a31015b9b760a3f (patch)
tree3fa5d74ea25f9b6651cf40a7258592fda9e6cc17
parent98fc0dc3b45fc61bf1056b8c5fc35d8f9ed4bc05 (diff)
downloadcouchdb-674683a7cfad4b5befd5a9002a31015b9b760a3f.tar.gz
Enable per-view-shard accessfix-shard-access
-rw-r--r--src/couch/src/couch_httpd_db.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/couch/src/couch_httpd_db.erl b/src/couch/src/couch_httpd_db.erl
index 1a07b202c..2418c1a4c 100644
--- a/src/couch/src/couch_httpd_db.erl
+++ b/src/couch/src/couch_httpd_db.erl
@@ -199,9 +199,15 @@ handle_design_req(#httpd{
false -> ok
end,
- % load ddoc
+ % maybe load ddoc through fabric
DesignId = <<"_design/", DesignName/binary>>,
- DDoc = couch_httpd_db:couch_doc_open(Db, DesignId, nil, [ejson_body]),
+ case couch_httpd_db:couch_doc_open(Db, DesignId, nil, [ejson_body]) of
+ not_found ->
+ DbName = mem3:dbname(couch_db:name(Db)),
+ {ok, DDoc} = fabric:open_doc(DbName, DesignId, [?ADMIN_CTX]);
+ DDoc ->
+ ok
+ end,
Handler = couch_util:dict_find(Action, DesignUrlHandlers, fun(_, _, _) ->
throw({not_found, <<"missing handler: ", Action/binary>>})
end),