Skip to content

Commit c7a6e9f

Browse files
ascorbicTylerBarnes
andauthoredMar 4, 2021
fix(gatsby-source-wordpress): image fixes (#29813) (#29881)
Co-authored-by: Ward Peeters <ward@coding-tech.com> (cherry picked from commit 28124dd) Co-authored-by: Tyler Barnes <tyler@gatsbyjs.com>

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
 

‎packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const { isWebUri } = require(`valid-url`)
88
const Queue = require(`better-queue`)
99
const readChunk = require(`read-chunk`)
1010
const fileType = require(`file-type`)
11-
const { createProgress } = require(`gatsby-source-filesystem/utils`)
1211

1312
const { createFileNode } = require(`gatsby-source-filesystem/create-file-node`)
1413
const {
@@ -431,7 +430,7 @@ module.exports = ({
431430
}
432431

433432
if (totalJobs === 0) {
434-
bar = createProgress(`Downloading remote files`, reporter)
433+
bar = reporter.createProgress(`Downloading remote files`)
435434
bar.start()
436435
}
437436

‎packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-media-item-node.js

+3
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ export const errorPanicker = ({
138138
)
139139
)
140140
reporter.panic(error)
141+
} else {
142+
console.error(error)
143+
reporter.panic()
141144
}
142145
}
143146

‎packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,11 @@ const replaceNodeHtmlLinks = ({ wpUrl, nodeString, node }) => {
827827
const normalizedPath = path.replace(/\\/g, ``)
828828

829829
// replace normalized match with relative path
830-
const thisMatchRegex = new RegExp(normalizedMatch, `g`)
830+
const thisMatchRegex = new RegExp(
831+
normalizedMatch + `(?!/?wp-content|/?wp-admin|/?wp-includes)`,
832+
`g`
833+
)
834+
831835
nodeString = nodeString.replace(thisMatchRegex, normalizedPath)
832836
} catch (e) {
833837
console.error(e)

0 commit comments

Comments
 (0)
Please sign in to comment.