Skip to content

Commit b9c7a9d

Browse files
Merge 509257b into 9fd3f52
2 parents 9fd3f52 + 509257b commit b9c7a9d

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.changeset/clever-kangaroos-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/database": patch
3+
---
4+
5+
Fixes an issue that caused `refFromUrl()` to reject production database URLs when `useEmulator()` was used.

packages/database/src/api/Database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class Database implements FirebaseService {
156156

157157
const repoInfo = parsedURL.repoInfo;
158158
if (
159-
!repoInfo.isCustomHost() &&
159+
!this.repo_.repoInfo_.isCustomHost() &&
160160
repoInfo.host !== this.repo_.repoInfo_.host
161161
) {
162162
fatal(

packages/database/test/database.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@ describe('Database Tests', () => {
246246
});
247247

248248
it('refFromURL() validates domain', () => {
249-
const db = (firebase as any).database();
250-
expect(() => {
251-
const ref = db.refFromURL(
252-
'https://thisisnotarealfirebase.firebaseio.com/path/to/data'
253-
);
254-
}).to.throw(/does not match.*database/i);
249+
const db = (firebase as any)
250+
.app()
251+
.database('https://thisisreal.firebaseio.com');
252+
expect(() =>
253+
db.refFromURL('https://thisisnotreal.firebaseio.com/path/to/data')
254+
).to.throw(/does not match.*database/i);
255255
});
256256

257257
it('refFromURL() validates argument', () => {

0 commit comments

Comments
 (0)