Skip to content

Commit

Permalink
fix(gatsby-source-wordpress): image fixes (#29813) (#29881)
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)

Co-authored-by: Tyler Barnes <tyler@gatsbyjs.com>
  • Loading branch information
ascorbic and TylerBarnes authored Mar 4, 2021
1 parent 890d5e5 commit c7a6e9f
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 @@ -827,7 +827,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 c7a6e9f

Please sign in to comment.