Skip to content
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

Firebase Storage encoding issue #149

Closed
chrisbianca opened this issue Aug 3, 2018 · 7 comments
Closed

Firebase Storage encoding issue #149

chrisbianca opened this issue Aug 3, 2018 · 7 comments
Assignees
Labels
bug Something isn't working completed Feature or request has been completed

Comments

@chrisbianca
Copy link

It looks like there might be another encoding issue with the new API version 4 which is affecting users of our app.

Firebase Storage generates downloadUrls of the following format:

https://firebasestorage.googleapis.com/v0/b/my-project-id.appspot.com/o/users%2FrJw5TEzI7KWbwOceIk0buONCwqe2%2Fimages%2F1504025036252-tumblr_static_tumblr_static_cheese_205_1362800142.jpg?alt=media&token=b2e5b9f6-e211-4f2b-b42d-60d316c2db25

You'll notice that this is already a URL encoded version of a URL and needs to be supplied to Firebase exactly as it for it to be interpreted properly.

For reference, the unencoded URL is:

https://firebasestorage.googleapis.com/v0/b/my-project-id.appspot.com/o/users/rJw5TEzI7KWbwOceIk0buONCwqe2/images/1504025036252-tumblr_static_tumblr_static_cheese_205_1362800142.jpg?alt=media&token=b2e5b9f6-e211-4f2b-b42d-60d316c2db25

To make this work with weserv, we URL encode the link and add the weserv prefix which gives the following and worked perfectly on v3:

https://images.weserv.nl/?url=ssl:firebasestorage.googleapis.com%2Fv0%2Fb%2Fmy-project-id.appspot.com%2Fo%2Fusers%252FrJw5TEzI7KWbwOceIk0buONCwqe2%252Fimages%252F1504025036252-tumblr_static_tumblr_static_cheese_205_1362800142.jpg%3Falt%3Dmedia%26token%3Db2e5b9f6-e211-4f2b-b42d-60d316c2db25

However, this now generates the following error:

Error 404: Server couldn't parse the ?url= that you were looking for, error it got: The requested URL returned error: 400

Looking at the error responses from Firebase Storage, it implies that the URL being passed from weserv is not being correctly decoded anymore.

I have obfuscated my Firebase project ID for obvious reasons, but am happy to supply privately to whoever is investigating the issue if it helps.

@andrieslouw andrieslouw added bug Something isn't working triage This issue is being investigated labels Aug 3, 2018
@andrieslouw
Copy link
Member

andrieslouw commented Aug 3, 2018

Indeed, API 4 strikes again, we already have a hunch of what the problem is this time. Please bear with us as we fix this, and again, we're sorry that these URL-bugs keep popping up.. (URL-encoding is really hard if you aren't using something like cURL, which we don't want to, as we're moving as close to native-C & Lua as we can get, because of performance).

@chrisbianca
Copy link
Author

No problem, if there's anything I can do to help, please let me know

@andrieslouw
Copy link
Member

As explained in our Privacy Policy we do keep 7 days of logs. We'll test some of your project URL's in our staging environment, so you may see some requests from 151.80.0.0/16 (AS16276) as we're trying to fix/test the problem.

@chrisbianca
Copy link
Author

Sure, thanks for the heads up

@andrieslouw
Copy link
Member

Passed staging environment, pushed to repo. Fix is being rolled out, caches are refreshing, keep us updated if the issue persists! 😄

@andrieslouw andrieslouw added completed Feature or request has been completed and removed triage This issue is being investigated labels Aug 3, 2018
@chrisbianca
Copy link
Author

Everything looks to be working again now - thank you for getting this fixed so quickly!

@RichardSieg
Copy link

RichardSieg commented Nov 29, 2019

The issue seemed to pop up again #199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed Feature or request has been completed
Development

No branches or pull requests

4 participants