Skip to content

Commit

Permalink
replacing hompage links can break images.. only replace if they don't…
Browse files Browse the repository at this point in the history
… include wp-content, etc
  • Loading branch information
TylerBarnes committed Feb 27, 2021
1 parent a9b139c commit 1a61ee7
Showing 1 changed file with 5 additions and 1 deletion.
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 1a61ee7

Please sign in to comment.