File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,8 @@ export const parseDatabaseURL = function(
181
181
const hostFirstPart = host . substring ( 0 , dotInd ) ;
182
182
if ( hostFirstPart . toLowerCase ( ) === 'localhost' ) {
183
183
domain = 'localhost' ;
184
+ } else if ( dotInd === colonInd ) {
185
+ return ; // Not a valid URL.
184
186
} else {
185
187
domain = host . substring ( dotInd + 1 ) ;
186
188
// Normalize namespaces to lowercase to share storage / connection.
Original file line number Diff line number Diff line change @@ -50,12 +50,6 @@ describe('Database Tests', () => {
50
50
expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'https://foo.bar.com/' ) ;
51
51
} ) ;
52
52
53
- it ( 'Can get database with custom URL' , ( ) => {
54
- const db = defaultApp . database ( 'http://foo.euw1.firebasedatabase.app' ) ;
55
- expect ( db ) . to . be . ok ;
56
- expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'https://foo.euw1.firebasedatabase.app/' ) ;
57
- } ) ;
58
-
59
53
it ( 'Can get database with custom URL and port' , ( ) => {
60
54
const db = defaultApp . database ( 'http://foo.bar.com:80' ) ;
61
55
expect ( db ) . to . be . ok ;
@@ -68,6 +62,13 @@ describe('Database Tests', () => {
68
62
expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'https://foo.bar.com/' ) ;
69
63
} ) ;
70
64
65
+ it ( 'Can get database with multi-region URL' , ( ) => {
66
+ const db = defaultApp . database ( 'http://foo.euw1.firebasedatabase.app' ) ;
67
+ expect ( db ) . to . be . ok ;
68
+ expect ( db . repo_ . repoInfo_ . namespace ) . to . equal ( 'foo' ) ;
69
+ expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'https://foo.euw1.firebasedatabase.app/' ) ;
70
+ } ) ;
71
+
71
72
it ( 'Can get database with localhost URL and port' , ( ) => {
72
73
const db = defaultApp . database ( 'http://localhost:80' ) ;
73
74
expect ( db ) . to . be . ok ;
You can’t perform that action at this time.
0 commit comments