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

createRemoteFileNode should parse out the query string from url #4460

Closed
m4rrc0 opened this issue Mar 9, 2018 · 8 comments
Closed

createRemoteFileNode should parse out the query string from url #4460

m4rrc0 opened this issue Mar 9, 2018 · 8 comments

Comments

@m4rrc0
Copy link
Contributor

m4rrc0 commented Mar 9, 2018

Description

When using createRemoteFileNode to fetch images and there are query parameters in the url, the file gets saved with a wrong extension and media type.
For example: to access Firebase assets one will use an url such as https://firebasestorage.googleapis.com/v0/b/[bucket name]/o/image.png?alt=media&token=[some token]

Steps to reproduce

const url = 'https://firebasestorage.googleapis.com/v0/b/test-pushtable-b6bb5.appspot.com/o/assets%2Favataaars_Marc.png?alt=media&token=33f1d5ed-4c19-40f7-a17a-9ab10dcac402'
createRemoteFileNode({
    url,
    store,
    cache,
    createNode,
  })

Expected result

One should get a someHash.png file in cache with correct media type

Actual result

File is named someHash.png?alt=media&token=theToken

Environment

  • Gatsby: 1.9.225
  • Gatsby-source-filesystem: 1.5.27
  • gatsby-cli: 1.1.45
  • Node.js version: 9.7.1
  • Operating System: Linux

Comments

I could try and make a PR next week but I would like confirmation that this is indeed something we want.
Is there some things I need to be aware of or pay attention to?

@pieh
Copy link
Contributor

pieh commented Mar 9, 2018

You can check #2985 - both code and comments - I had similar problem, but went with different approach so I "workarounded" this issue and ultimately didn't fix this.

@m4rrc0
Copy link
Contributor Author

m4rrc0 commented Mar 9, 2018

Thanks @pieh I hadn't catch that PR.

@KyleAMathews
Copy link
Contributor

What's the problem? The file is being saved as .png which is what you want right?

@m4rrc0
Copy link
Contributor Author

m4rrc0 commented Mar 11, 2018

Humm... no it is not. As I mentioned the name of the file being saved is something like
someHash.png?alt=media&token=theToken.
This is the correct file but it is not processed by Sharp as the extension is not .png and the media type is not image/png...

@KyleAMathews
Copy link
Contributor

What is the extension and mediaType?

@KyleAMathews
Copy link
Contributor

In the File node

@m4rrc0
Copy link
Contributor Author

m4rrc0 commented Mar 11, 2018

application/octet-stream
It is the same issue as pieh mentionned above: #2985
To be honest I probably won't be using Firebase in the end so this is not a priority for me.
I still think other people will end up with the same issue at some point though.

@KyleAMathews
Copy link
Contributor

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants