Skip to content

Commit 1488424

Browse files
committed
pass
1 parent 1494388 commit 1488424

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/database/src/core/util/libs/parser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ export const parseDatabaseURL = function(
181181
const hostFirstPart = host.substring(0, dotInd);
182182
if (hostFirstPart.toLowerCase() === 'localhost') {
183183
domain = 'localhost';
184+
} else if (dotInd === colonInd) {
185+
return; // Not a valid URL.
184186
} else {
185187
domain = host.substring(dotInd+1);
186188
// Normalize namespaces to lowercase to share storage / connection.

packages/database/test/database.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ describe('Database Tests', () => {
5050
expect(db.ref().toString()).to.equal('https://foo.bar.com/');
5151
});
5252

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-
5953
it('Can get database with custom URL and port', () => {
6054
const db = defaultApp.database('http://foo.bar.com:80');
6155
expect(db).to.be.ok;
@@ -68,6 +62,13 @@ describe('Database Tests', () => {
6862
expect(db.ref().toString()).to.equal('https://foo.bar.com/');
6963
});
7064

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+
7172
it('Can get database with localhost URL and port', () => {
7273
const db = defaultApp.database('http://localhost:80');
7374
expect(db).to.be.ok;

0 commit comments

Comments
 (0)