From 2ea18bdaa19ea7f2da1a5dccce65d50cf0efc64d Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Thu, 20 Jan 2011 11:00:58 -0500 Subject: Make shards visible on backend, be more strict about naming BugzID: 10162 --- apps/couch/src/couch_server.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'apps/couch/src/couch_server.erl') diff --git a/apps/couch/src/couch_server.erl b/apps/couch/src/couch_server.erl index 0624e71f..4441fd16 100644 --- a/apps/couch/src/couch_server.erl +++ b/apps/couch/src/couch_server.erl @@ -128,7 +128,10 @@ init([]) -> ok = couch_config:register(fun ?MODULE:config_change/4), ok = couch_file:init_delete_dir(RootDir), hash_admin_passwords(), - {ok, RegExp} = re:compile("^[a-z][a-z0-9\\_\\$()\\+\\-\\/\\.]*$"), + {ok, RegExp} = re:compile( + "^[a-z][a-z0-9\\_\\$()\\+\\-\\/]*" % use the stock CouchDB regex + "(\\.[0-9]{10,})?$" % but allow an optional shard timestamp at the end + ), ets:new(couch_dbs, [set, protected, named_table, {keypos, #db.name}]), ets:new(couch_lru, [set, public, named_table]), process_flag(trap_exit, true), @@ -157,7 +160,10 @@ all_databases(Prefix) -> {ok, #server{root_dir=Root}} = gen_server:call(couch_server, get_server), NormRoot = couch_util:normpath(Root), Filenames = - filelib:fold_files(Root++Prefix, "^[a-z0-9\\_\\$()\\+\\-]*[\\.]couch$", + filelib:fold_files(Root++Prefix, + "^[a-z0-9\\_\\$()\\+\\-]*" % stock CouchDB name regex + "(\\.[0-9]{10,})?" % optional shard timestamp + "\\.couch$", % filename extenstion true, fun(Filename, AccIn) -> NormFilename = couch_util:normpath(Filename), -- cgit v1.2.3