-
Notifications
You must be signed in to change notification settings - Fork 948
Support storage.googleapis.com in refFromUrl #2758
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
Conversation
3682644
to
3f07169
Compare
2b2e724
to
88ef89a
Compare
}); | ||
it('Works with storage.cloud.google.com URLs', () => { | ||
const ref = service.refFromURL( | ||
`https://storage.cloud.google.com/mybucket/path%20with%20space/image.png` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOC, will this generate the same result?
https://storage.cloud.google.com/mybucket/path%20with%20space%2Fimage.png
Maybe add a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test.
const httpRegex = new RegExp( | ||
`^https?://${hostRegex}/${version}/b/${bucketDomain}/o${path}`, | ||
const firebaseStorageHost = DEFAULT_HOST.replace(/[.]/g, '\\.'); | ||
const firebaseStoragePath = '(/([^?#]*).*)?$'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's special about #
? Trying to understand the difference between firebaseStoragePath
and cloudStoragePath
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably exclude #
in both cases, even though I don't see GCS creating URLs that provide anchors. I updated the cloudStoragePath
.
I am not sure why we are using an extra .*
in firebaseStoragePath
, but I'd rather leave it the way it was as I can see neither harm nor benefit.
@Feiyang1 for approval. Thanks. |
Binary Size ReportAffected SDKs
Test Logs |
This modifies refFromUrl to accept URLs generated by Cloud Storage.
Tested that this supports URLs from the Cloud Console as well as the format specified here:
https://cloud.google.com/storage/docs/access-control/signed-urls
Fixes #2625