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

fix(gatsby-transformer-sharp): Dereference symlinks when copying files #31511

Merged

Conversation

jgosmann
Copy link
Contributor

Description

Without dereferencing the symlink itself is copied which has two problems:

  • It might point at the wrong location for a relative symlink.
  • The next time around the copy operation will fail with an EEXIST (file already exists) error. This requires then a gatsby clean to be able to build again.

As this is the second time, I stumble upon an issue of this sort it Gatsby, I wonder if anything can be done to prevent the same issue from cropping up again in the future? But I don't see anything obvious or cheap solution ...

Why do I have symlinks?

My Gatsby site has many images and committing them directly to the Git repository wouldn't be a good idea due to the file size.Instead I'm using git-annex which replaces the files with relative symbolic links.

Related Issues

An equivalent fix was previously done for gatsby-source-filesystem in #24025.

Without dereferencing the symlink itself is copied which has two
problems:

* It might point at the wrong location for a relative symlink.
* The next time around the copy operation will fail with an EEXIST
  (file already exists) error. This requires then a `gatsby clean`
  to be able to build again.

An equivalent fix was previously done for gatsby-source-filesystem
in eb8db3c.
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 20, 2021
@wardpeet
Copy link
Contributor

🙏 thank you!

@wardpeet wardpeet added topic: sharp and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 21, 2021
@wardpeet wardpeet added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label May 21, 2021
@LekoArts LekoArts merged commit 151d269 into gatsbyjs:master May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants