-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
gatsby-source-filesystem's publicURL should keep file name #22244
Comments
Well, even though the link href is exactly the same, the manual link opens the 404 page, and when the browser reloads it opens the PDF (using the component Link imported from gatsby), whereas with the Markdown link the PDF opens directly. And I can't see any hook in the code. |
Ah I shouldn't use I can make a PR if you want. It's only about this single line. |
We'd appreciate a PR fixing this. Thanks a lot! |
Here's the PR! |
Summary
Change the file publicURL pattern from
${file.name}-${file.internal.contentDigest}${details.ext}
to${file.internal.contentDigest}/${file.base}
.gatsby/packages/gatsby-source-filesystem/src/extend-file-node.js
Line 17 in 2c08909
Motivation
My concern is that files which should be downloaded are renamed, and visitors shouldn't know about that.
Right now, if I'm giving a link to say
Brand-ProductCatalog.pdf
, the link actually points to/static/Brand-ProductCatalog-f4c0ceb6e2839acca98c07d3839833e4.pdf
, and this looks weird if someone downloads it and see the digest in their finder.If instead I'm putting the link in a .md file, thanks to
gatsby-remark-copy-linked-files
the path is/static/f4c0ceb6e2839acca98c07d3839833e4/Brand-ProductCatalog.pdf
which is what I want: the filename isn't changed.But I want to do it directly, without having to put the link in a .md file.
This problem was mentioned at #9777 (comment) but I can't find a commit that changes this.
The text was updated successfully, but these errors were encountered: