Alexander Shorin created COUCHDB-1840:
-----------------------------------------

             Summary: Better check for public_field value
                 Key: COUCHDB-1840
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1840
             Project: CouchDB
          Issue Type: Improvement
            Reporter: Alexander Shorin


It's possible to run into issue COUCHDB-1838 and enable `public_fields` feature 
without actually specifying any public fields:

{code}
[couch_httpd_auth]
public_field = ,
{code}

Because of [split 
code|https://git-wip-us.apache.org/repos/asf?p=couchdb.git;a=blob;f=src/couchdb/couch_users_db.erl;h=9b875ba56d02d398049bb828015a37d219bcf6fd;hb=8d7ab8b18dd20f8785e69f4420c6f93a2edbfa60#l118]:
{code}
strip_non_public_fields(#doc{body={Props}}=Doc) ->
    Public = re:split(couch_config:get("couch_httpd_auth", "public_fields", ""),
                       "\\s*,\\s*", [{return, binary}]),
    Doc#doc{body={[{K, V} || {K, V} <- Props, lists:member(K, Public)]}}.
{code}

The parameter's value as comma (`,`) will produce empty Public list. Probably, 
it's better to check him for any members and/or strip all empty string members 
before counting `public_fields` parameter activated.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to