Skip to content

Commit 95d7737

Browse files
authored
fix(gatsby-source-filesystem): dereference symlinks when copying files with publicURL (#24025)
1 parent 0f53567 commit 95d7737

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

packages/gatsby-source-filesystem/src/extend-file-node.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ module.exports = ({ type, getNodeAndSavePathDependency, pathPrefix = `` }) => {
2424
)
2525

2626
if (!fs.existsSync(publicPath)) {
27-
fs.copy(details.absolutePath, publicPath, err => {
28-
if (err) {
29-
console.error(
30-
`error copying file from ${details.absolutePath} to ${publicPath}`,
31-
err
32-
)
27+
fs.copy(
28+
details.absolutePath,
29+
publicPath,
30+
{ dereference: true },
31+
err => {
32+
if (err) {
33+
console.error(
34+
`error copying file from ${details.absolutePath} to ${publicPath}`,
35+
err
36+
)
37+
}
3338
}
34-
})
39+
)
3540
}
3641

3742
return `${pathPrefix}/static/${fileName}`

0 commit comments

Comments
 (0)