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-source-filesystem): dereference symlinks when copying files with publicURL #24025

Merged
merged 1 commit into from
May 13, 2020

Conversation

jgosmann
Copy link
Contributor

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.

@jgosmann jgosmann requested a review from a team as a code owner May 12, 2020 18:48
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 12, 2020
@madalynrose madalynrose added status: needs core review Currently awaiting review from Core team member and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 12, 2020
@pieh pieh changed the title Dereference symlinks when copying to public path fix(gatsby-source-filesystem): dereference symlinks when copying files with publicURL May 13, 2020
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jgosmann!

Tested and verified it works correctly.

I expect we might need similar changes in few other places as well, but this is good to go in on its own (no point delaying the fix)

@pieh pieh merged commit 95d7737 into gatsbyjs:master May 13, 2020
@gatsbot
Copy link

gatsbot bot commented May 13, 2020

Holy buckets, @jgosmann — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. We’ve got Gatsby t-shirts, stickers, hats, scrunchies, and much more. (You can also unlock even more free swag with 5 contributions — wink wink nudge nudge.) See gatsby.dev/swag for details.
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs core review Currently awaiting review from Core team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants