jiahuili430 commented on code in PR #4494:
URL: https://github.com/apache/couchdb/pull/4494#discussion_r1156228674


##########
src/couch_mrview/src/couch_mrview_http.erl:
##########
@@ -513,8 +518,20 @@ parse_body_and_query(Req, Keys) ->
 
 parse_body_and_query(Req, {Props}, Keys) ->
     Args = #mrargs{keys = Keys, group = undefined, group_level = undefined},
-    BodyArgs = parse_params(Props, Keys, Args, [decoded]),
-    parse_params(chttpd:qs(Req), Keys, BodyArgs, [keep_group_level]).
+    BodyArgs0 = parse_params(Props, Keys, Args, [decoded]),
+    BodyArgs1 = treat_single_keys_as_key(Req, BodyArgs0),
+    parse_params(chttpd:qs(Req), Keys, BodyArgs1, [keep_group_level]).
+
+treat_single_keys_as_key(#httpd{path_parts = Path}, #mrargs{keys = Keys} = 
BodyArgs) ->
+    case lists:member(<<"_view">>, Path) of

Review Comment:
   This way is much safer than just checking if `_view` exists in the path 
parts, thanks for the suggestion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to