Skip to content

Commit

Permalink
fix(gatsby-source-filesystem): dereference symlinks when copying file…
Browse files Browse the repository at this point in the history
…s with `publicURL` (#24025)
  • Loading branch information
jgosmann committed May 13, 2020
1 parent 0f53567 commit 95d7737
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/gatsby-source-filesystem/src/extend-file-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ module.exports = ({ type, getNodeAndSavePathDependency, pathPrefix = `` }) => {
)

if (!fs.existsSync(publicPath)) {
fs.copy(details.absolutePath, publicPath, err => {
if (err) {
console.error(
`error copying file from ${details.absolutePath} to ${publicPath}`,
err
)
fs.copy(
details.absolutePath,
publicPath,
{ dereference: true },
err => {
if (err) {
console.error(
`error copying file from ${details.absolutePath} to ${publicPath}`,
err
)
}
}
})
)
}

return `${pathPrefix}/static/${fileName}`
Expand Down

0 comments on commit 95d7737

Please sign in to comment.