Skip to content

Commit

Permalink
fix(gatsby-source-wordpress): image fixes (#29813)
Browse files Browse the repository at this point in the history
Co-authored-by: Ward Peeters <ward@coding-tech.com>
(cherry picked from commit 28124dd)
  • Loading branch information
TylerBarnes authored and ascorbic committed Mar 1, 2021
1 parent 9ecbc81 commit d2462b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { isWebUri } = require(`valid-url`)
const Queue = require(`better-queue`)
const readChunk = require(`read-chunk`)
const fileType = require(`file-type`)
const { createProgress } = require(`gatsby-source-filesystem/utils`)

const { createFileNode } = require(`gatsby-source-filesystem/create-file-node`)
const {
Expand Down Expand Up @@ -431,7 +430,7 @@ module.exports = ({
}

if (totalJobs === 0) {
bar = createProgress(`Downloading remote files`, reporter)
bar = reporter.createProgress(`Downloading remote files`)
bar.start()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ export const errorPanicker = ({
)
)
reporter.panic(error)
} else {
console.error(error)
reporter.panic()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,11 @@ const replaceNodeHtmlLinks = ({ wpUrl, nodeString, node }) => {
const normalizedPath = path.replace(/\\/g, ``)

// replace normalized match with relative path
const thisMatchRegex = new RegExp(normalizedMatch, `g`)
const thisMatchRegex = new RegExp(
normalizedMatch + `(?!/?wp-content|/?wp-admin|/?wp-includes)`,
`g`
)

nodeString = nodeString.replace(thisMatchRegex, normalizedPath)
} catch (e) {
console.error(e)
Expand Down

0 comments on commit d2462b5

Please sign in to comment.