iilyak commented on a change in pull request #1588: Check if db exists in 
/db/_ensure_full_commit call
URL: https://github.com/apache/couchdb/pull/1588#discussion_r213819774
 
 

 ##########
 File path: src/chttpd/src/chttpd_db.erl
 ##########
 @@ -375,8 +375,10 @@ db_req(#httpd{method='POST', path_parts=[DbName], 
user_ctx=Ctx}=Req, Db) ->
 db_req(#httpd{path_parts=[_DbName]}=Req, _Db) ->
     send_method_not_allowed(Req, "DELETE,GET,HEAD,POST");
 
-db_req(#httpd{method='POST',path_parts=[_,<<"_ensure_full_commit">>]}=Req, 
_Db) ->
+db_req(#httpd{method='POST', path_parts=[DbName, <<"_ensure_full_commit">>],
+        user_ctx=Ctx}=Req, _Db) ->
     chttpd:validate_ctype(Req, "application/json"),
+    fabric:get_security(DbName, [{user_ctx, Ctx}]),
 
 Review comment:
   I think there is a need for a comment here to describe why the call is 
needed and the reason for `fabric:get_security/2` to be used for database 
existence check (get_security uses local shards while `fabric:get_db_info` for 
example uses non local shards as well)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to