fix(gatsby-source-filesystem): dereference symlinks when copying files with publicURL
#24025
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I have some larger assets in one of my Gatsby projects that I pull in with gatsby-source-filesystem. Due to the file sizes involved, I want to avoid committing those files to git. Instead I'm using git-annex which replaces the files with relative symbolic links (e.g.
../../../../.git/annex/objects/...
. Currently, gatsby-source-filesystem copies the link itself to the public folder when building the site which breaks the link.This PR adds the "dereference" option to the copy call which will cause the actual file content to be copied and produce a working build even if symbolic links are involved.
Documentation
As far as I am aware it is not documented how symlinks are handled. Not sure if it needs to be, I would expect symlinks to be dereferenced anyways.
Related Issues
None that I am aware of.