Skip to content

Add protocol as a separate property for FirebaseStorage service #5453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 8, 2021

Conversation

hsubox76
Copy link
Contributor

@hsubox76 hsubox76 commented Sep 7, 2021

I tried to avoid adding another property to the service in the initial emulator PR by having some logic in makeUrl to deal with the fact that host could contain a protocol or not. Unfortunately Location.refFromUrl doesn't use makeUrl and this caused a bug where there were duplicate protocol strings in the regex. Trying to keep "host" in a consistent format now to avoid future mistakes, separating "protocol" into a separate field.

Fixes firebase/firebase-tools#3715

@changeset-bot
Copy link

changeset-bot bot commented Sep 7, 2021

🦋 Changeset detected

Latest commit: 307f7e3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/storage Patch
firebase Patch
@firebase/storage-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2021

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.

@google-oss-bot google-oss-bot added the doc-changes PRs that affect docs label Sep 7, 2021
'http://localhost:3001/v0/b/abcdefg.appspot.com/o/abcde.txt',
'localhost:3001'
);
expect(loc.bucket).to.equal('abcdefg.appspot.com');
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we test the protocol here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Location doesn't seem to store the host or the protocol, makeFromUrl just uses them to do regex matches and then throws them away. It only seems to have bucket, and path (just the part after the bucket).

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, got it.

*/
private _host: string = DEFAULT_HOST;
protocol: string = 'https';
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be exposed via the API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This whole class is internal so it shouldn't be exposed publicly. But it can't be private since connectStorageEmulator needs to be able to set it. I can add an underscore so it's clear that it's not meant to be public?

Copy link
Contributor

Choose a reason for hiding this comment

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

The rest of the class does use underscores. I merely asked because of the change in the API report as it is not obvious that this is not exposed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an underscore.

*/
private _host: string = DEFAULT_HOST;
protocol: string = 'https';
Copy link
Contributor

Choose a reason for hiding this comment

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

The rest of the class does use underscores. I merely asked because of the change in the API report as it is not obvious that this is not exposed.

'http://localhost:3001/v0/b/abcdefg.appspot.com/o/abcde.txt',
'localhost:3001'
);
expect(loc.bucket).to.equal('abcdefg.appspot.com');
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, got it.

@Feiyang1 Feiyang1 removed their assignment Sep 8, 2021
@Feiyang1
Copy link
Member

Feiyang1 commented Sep 8, 2021

please add changeset

@hsubox76 hsubox76 requested a review from egilmorez as a code owner September 8, 2021 22:57
@hsubox76 hsubox76 merged commit 66d4a1e into master Sep 8, 2021
@hsubox76 hsubox76 deleted the ch-storage-emulator-protocol branch September 8, 2021 23:45
@google-oss-bot google-oss-bot mentioned this pull request Sep 9, 2021
@firebase firebase locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
doc-changes PRs that affect docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refFromURL() is not working in local?
5 participants