Skip to content

fix(gatsby-source-filesystem): dereference symlinks when copying files with publicURL - #24025

Merged
pieh merged 1 commit into
gatsbyjs:masterfrom
jgosmann:master
May 13, 2020
Merged

fix(gatsby-source-filesystem): dereference symlinks when copying files with publicURL#24025
pieh merged 1 commit into
gatsbyjs:masterfrom
jgosmann:master

Conversation

@jgosmann

Copy link
Copy Markdown
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 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

@pieh pieh left a comment

Copy link
Copy Markdown
Contributor

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

gatsbot Bot commented May 13, 2020

Copy link
Copy Markdown

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!

mwfrost pushed a commit to mwfrost/gatsby that referenced this pull request Apr 20, 2023
raffishquartan pushed a commit to raffishquartan/gatsby that referenced this pull request Apr 28, 2026
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