Skip to content

Commit

Permalink
Merge pull request #337 from mjmlio/fix-336
Browse files Browse the repository at this point in the history
fix #336 warnForRelativePath when no matches
  • Loading branch information
kmcb777 authored Dec 30, 2020
2 parents e43ff4f + 96c08e2 commit f19b4cf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/Project/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ export default connect(
const { preview } = this.props
const relativePathsRegex = new RegExp(/(?:href|src)=(["'])(?!mailto|https|http|data:).*?\1/g)
let matches = preview.content.match(relativePathsRegex)
matches = matches.map(match => `■ ${match}`)
this.props.addAlert(['Found possible non-absolute paths:', ...matches], 'error', {
autoHide: false,
})
if (matches) {
matches = matches.map(match => `■ ${match}`)
this.props.addAlert(['Found possible non-absolute paths:', ...matches], 'error', {
autoHide: false,
})
}
}

getHTMLOutput() {
Expand Down

0 comments on commit f19b4cf

Please sign in to comment.