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

Better default for gatsby-remark-copy-linked-files #10048

Closed
lekevicius opened this issue Nov 20, 2018 · 7 comments
Closed

Better default for gatsby-remark-copy-linked-files #10048

lekevicius opened this issue Nov 20, 2018 · 7 comments

Comments

@lekevicius
Copy link

lekevicius commented Nov 20, 2018

Summary

Default for file URLs should be hash/filename.ext, not filename-hash.ext

Basic example

Currently the default is file.pdf -> file-ea0f4f14f1b991e92c681da93172497d.pdf.

It is set in this function:

const newFileName = linkNode =>
  `${linkNode.name}-${linkNode.internal.contentDigest}.${linkNode.extension}`

I suggest to make the default URL be:

const newFileName = linkNode =>
  `${linkNode.internal.contentDigest}/${linkNode.name}.${linkNode.extension}`

This would follow the general structure of gatsby-image paths, and make downloaded file name much nicer.

If default is not changed then at least this should be a customizable option, perhaps a function that could be passed.

Motivation

Currently, for every user downloading the file, filename is very long. In many cases the "hash" part is much longer than the actual file name. Default setting should be nicer.

@pieh
Copy link
Contributor

pieh commented Nov 23, 2018

I think that's good idea - we would possibly need to ensure that extra directory exists.

@lekevicius would you be interested in creating PR with this change?

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 2, 2019
@gatsbot
Copy link

gatsbot bot commented Feb 2, 2019

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! 💪💜

@KyleAMathews
Copy link
Contributor

Yeah this would be a good change. We made the same change for image paths.

@lekevicius
Copy link
Author

The Kyle has spoken.

I'll try to make a PR this week.

@m-allanson m-allanson removed the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 12, 2019
@gatsbot
Copy link

gatsbot bot commented Mar 5, 2019

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! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Mar 5, 2019
@gatsbot
Copy link

gatsbot bot commented Mar 16, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

@gatsbot gatsbot bot closed this as completed Mar 16, 2019
@kimbaudi
Copy link
Contributor

kimbaudi commented Aug 8, 2019

Hi, I would like to implement this feature. I will submit a PR shortly 🤞

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

6 participants