@11ty/eleventy-plugin-rss
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "@11ty/eleventy-plugin-rss", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A pack of Eleventy plugins for generating an RSS feed using the Nunjucks templating engine.", | ||
@@ -29,3 +29,3 @@ "main": ".eleventy.js", | ||
"@11ty/eleventy": "^0.6.0", | ||
"ava": "^0.25.0" | ||
"ava": "^1.0.1" | ||
}, | ||
@@ -32,0 +32,0 @@ "dependencies": { |
const { URL } = require("url"); | ||
const debug = require("debug")("EleventyPluginRSS"); | ||
module.exports = function(url, base) { | ||
return (new URL(url, base)).toString() | ||
try { | ||
return (new URL(url, base)).toString() | ||
} catch(e) { | ||
debug("Trying to convert %o to be an absolute url with base %o and failed, returning: %o (invalid url)", url, base, url) | ||
// TODO add debug output! | ||
return url; | ||
} | ||
}; |
@@ -10,1 +10,5 @@ import test from "ava"; | ||
}); | ||
test("Bad link href", async t => { | ||
t.is((await htmlToAbsUrls(`<a href="http://#">Hello</a>`, "http://example.com/")).html, `<a href="http://#">Hello</a>`); | ||
}); |
7988
68