iilyak commented on code in PR #3990:
URL: https://github.com/apache/couchdb/pull/3990#discussion_r850535212


##########
src/mango/src/mango_opts.erl:
##########
@@ -240,6 +241,13 @@ validate_idx_name(auto_name) ->
 validate_idx_name(Else) ->
     is_string(Else).
 
+validate_idx_ddoc(auto_name) ->

Review Comment:
   It seems like there is another similar bug in the area. Someone could give 
`name = ""`, which doesn't make sense.
   
   Therefore I propose different fix.
   
   ```
   non_empty_string(<<>> = Else)  ->
       ?MANGO_ERROR({invalid_non_empty_string, Else}).
   non_empty_string(Val) when is_binary(Val) ->
       {ok, Val};
   non_empty_string(Else) ->
       ?MANGO_ERROR({invalid_non_empty_string, Else}).
       
   validate_idx_name(auto_name) ->
       {ok, auto_name};
   validate_idx_name(Else) ->
       non_emtpy_string(Else).
   ```



-- 
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