Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clever-kangaroos-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/database": patch
---

Fixes an issue that caused `refFromUrl()` to reject production database URLs when `useEmulator()` was used.
2 changes: 1 addition & 1 deletion packages/database/src/api/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class Database implements FirebaseService {

const repoInfo = parsedURL.repoInfo;
if (
!repoInfo.isCustomHost() &&
!this.repo_.repoInfo_.isCustomHost() &&
repoInfo.host !== this.repo_.repoInfo_.host
) {
fatal(
Expand Down
12 changes: 6 additions & 6 deletions packages/database/test/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ describe('Database Tests', () => {
});

it('refFromURL() validates domain', () => {
const db = (firebase as any).database();
expect(() => {
const ref = db.refFromURL(
'https://thisisnotarealfirebase.firebaseio.com/path/to/data'
);
}).to.throw(/does not match.*database/i);
const db = (firebase as any)
.app()
.database('https://thisisreal.firebaseio.com');
expect(() =>
db.refFromURL('https://thisisnotreal.firebaseio.com/path/to/data')
).to.throw(/does not match.*database/i);
});

it('refFromURL() validates argument', () => {
Expand Down