You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/04/14 15:00:44 UTC

[GitHub] [couchdb] iilyak commented on a diff in pull request #3990: Creating index with "ddoc":"" should return 400 Bad Request

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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org