Skip to content

Commit

Permalink
fix(transformer-remark): dont process relative image urls
Browse files Browse the repository at this point in the history
  • Loading branch information
hjvedvik committed Oct 30, 2018
1 parent d0a83b5 commit 7d4edf3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/transformer-remark/lib/plugins/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function attacher () {

if (path.isAbsolute(node.internal.origin)) {
visit(tree, 'image', node => {
if (!isUrl(node.url)) images.push(node)
if (isLocalPath(node.url)) images.push(node)
})
}

Expand All @@ -38,3 +38,8 @@ module.exports = function attacher () {
callback()
}
}

function isLocalPath (string) {
if (/^\//.test(string)) return false
return !isUrl(string)
}

0 comments on commit 7d4edf3

Please sign in to comment.