jiangphcn commented on a change in pull request #1647: Validate database prefix
against DBNAME_REGEX for system dbs
URL: https://github.com/apache/couchdb/pull/1647#discussion_r228139077
##########
File path: src/couch/src/couch_db.erl
##########
@@ -1738,8 +1738,15 @@ validate_dbname_int(DbName, Normalized) when
is_binary(DbName) ->
is_systemdb(DbName) when is_list(DbName) ->
is_systemdb(?l2b(DbName));
is_systemdb(DbName) when is_binary(DbName) ->
- lists:member(dbname_suffix(DbName), ?SYSTEM_DATABASES).
-
+ Normalized = normalize_dbname(DbName),
+ Suffix = filename:basename(Normalized),
+ case {filename:dirname(Normalized), lists:member(Suffix,
?SYSTEM_DATABASES)} of
+ {<<".">>, Result} -> Result;
+ {Prefix, false} -> false;
Review comment:
Just happen to find warning
`.../db/src/couchdb/src/couch/src/couch_db.erl:1748: Warning: variable 'Prefix'
is unused`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services