null+****@clear*****
null+****@clear*****
2012年 6月 21日 (木) 13:24:01 JST
Yoji SHIDARA 2012-06-21 13:24:01 +0900 (Thu, 21 Jun 2012) New Revision: e309e1f9903fb4009309b257772470c877a6f1a7 https://github.com/groonga/gcs/commit/e309e1f9903fb4009309b257772470c877a6f1a7 Log: Dots should not be included in domain name Modified files: lib/domain.js test/domain.test.js Modified: lib/domain.js (+1 -1) =================================================================== --- lib/domain.js 2012-06-21 12:55:52 +0900 (0605b56) +++ lib/domain.js 2012-06-21 13:24:01 +0900 (1974bfb) @@ -78,7 +78,7 @@ Domain.prototype = { exports.Domain = Domain; Domain.getNameFromHost = function(host) { - var domainMatcher = /^(?:doc|search)-(.+)-([^\.\-]+)\./; + var domainMatcher = /^(?:doc|search)-([^\.]+)-([^\.\-]+)\./; var match = host.match(domainMatcher); if (match) return match[1]; Modified: test/domain.test.js (+6 -0) =================================================================== --- test/domain.test.js 2012-06-21 12:55:52 +0900 (cbcc702) +++ test/domain.test.js 2012-06-21 13:24:01 +0900 (206e94e) @@ -111,6 +111,12 @@ suite('domain', function() { assert.equal(name, 'test-0123'); }); + test('valid, search, lower case, hyphen and number, deep subdomain including region identifier', function() { + var host = 'search-test-0123-id0123.us-east-1.example.com'; + var name = Domain.getNameFromHost(host); + assert.equal(name, 'test-0123'); + }); + test('invalid', function() { var host = 'cloudsearch.example.com'; var name = Domain.getNameFromHost(host); -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...Download