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/07/14 15:06:47 UTC

[GitHub] [couchdb] nickva commented on a diff in pull request #4108: Trim X-Auth-CouchDB-Roles header after reading

nickva commented on code in PR #4108:
URL: https://github.com/apache/couchdb/pull/4108#discussion_r921264840


##########
src/couch/src/couch_httpd_auth.erl:
##########
@@ -189,7 +189,7 @@ proxy_auth_user(Req) ->
             Roles =
                 case header_value(Req, XHeaderRoles) of
                     undefined -> [];
-                    Else -> [?l2b(R) || R <- string:tokens(Else, ",")]
+                    Else -> re:split(Else, "\\s*,\\s*", [trim, {return, binary}])

Review Comment:
   Did we already strip whitespace on both sides of the input (`Else`)?  Otherwise we get different behavior there:
   
   > re:split(" a , b,c ,d ", "\\s*,\\s*", [trim, {return, list}]).
   [" a","b","c","d "]
   
   > string:tokens(" a  , b,c, d ", " ,").
   ["a","b","c","d"]
   
   



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