-
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] createRemoteFileNode: Keep original name #9539
Comments
I'll have a go at this. |
What's the practicality of allowing the hash to be customizable too (or fully remove for non-duplicate filenames?)? I'm moving a site over that has a bunch of PDFs on it. I'm using gatsby-source-directus to pull down the PDFs from my Directus server, which uses Our current PDF urls look something like this - https://www.example.com/static/Financial_Disclosure_Form.pdf - and the users frequently will use ⌘+S to save the PDFs. Right now, this causes the default filename to be the MD5 hash of the file It looks like PR #9777 will make it so the filename is
Do any of those ideas seam feasible? |
Hey @jkjustjoshing I think what you've proposed for (1) is reasonable and makes total sense to have the filename first. With regards to (2) & (3), I think there are different use cases based on the source. For images, the filename may not mean as much compared to downloadable content like documents. So we could add an optional parameter to As to (4), I'm a little unclear by this one, could you please elaborate a bit more on what you mean a list of all other defined file? and maybe provide an example of what you envision? Keen to hear what others think. |
I think we could keep original filename and just put file in directory with hash. @jkjustjoshing How are you referencing files when constructing download links - using query and |
#4 would be a way to fully customize the filename while still avoiding collisions - if the callback is passed a list of all other files the plugin implementer could check for duplicates and ensure any potential collisions are avoided. I really like your suggestion @pieh, putting a file in a folder with the hash (potentially doing so only when a flag is passed to Are there any performance implications for projects with a very large number of files to having 1 folder per file? |
Sorry just got back from an overseas holiday, I've updated the PR so that files are stored in directories of the hash. e.g. |
Awesome! Thanks for your work on this! |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Fixed with #9777 |
Summary
Since this issue (#6232) was fixed by @Sekhmet only one thing is left: Also keep the original file name in the downloaded image (as per old issue #3132). Other requests: prismicio/prismic-gatsby#40
@Sekhmet do you want to tackle that issue, too?
A result should be, e.g.:
/static/f28264fbe0c2cf6d02c3b8adc54b717b/18b00/e10dce13ec246d93bf6e57ede0d98ce8.jpg
/static/f28264fbe0c2cf6d02c3b8adc54b717b/18b00/e10dce13ec246d93bf6e57ede0d98ce8/this-is-the-super-name-here.jpg
The text was updated successfully, but these errors were encountered: