Skip to content

Commit

Permalink
fix(storage, android): honor android_bypass_emulator_url_remap flag (#…
Browse files Browse the repository at this point in the history
…7326)

* Add androidBypassEmulatorUrlRemap flag validation for storage

* style(lint): `yarn lint:js --fix`

---------

Co-authored-by: Mike Hardy <github@mikehardy.net>
  • Loading branch information
PedroDuarte536 and mikehardy authored Sep 4, 2023
1 parent f323891 commit 794e081
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/storage/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,13 @@ class FirebaseStorageModule extends FirebaseModule {
if (!host || !isString(host) || !port || !isNumber(port)) {
throw new Error('firebase.storage().useEmulator() takes a non-empty host and port');
}

let _host = host;
if (isAndroid && _host) {

const androidBypassEmulatorUrlRemap =
typeof this.firebaseJson.android_bypass_emulator_url_remap === 'boolean' &&
this.firebaseJson.android_bypass_emulator_url_remap;
if (!androidBypassEmulatorUrlRemap && isAndroid && _host) {
if (_host === 'localhost' || _host === '127.0.0.1') {
_host = '10.0.2.2';
// eslint-disable-next-line no-console
Expand Down

1 comment on commit 794e081

@vercel
Copy link

@vercel vercel bot commented on 794e081 Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.