diff --git a/CHANGELOG.md b/CHANGELOG.md index 51f2a7e..68f64f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased ### Fixed +- Fix bot crash if feed article contains link with invalid host name - Temporary fix for bot crash if used with a feed without links in the articles (didn't realise this was possible...) ## v3.1.3 diff --git a/app/models/feed-data.js b/app/models/feed-data.js index 26e3fc6..4fc5c18 100644 --- a/app/models/feed-data.js +++ b/app/models/feed-data.js @@ -107,7 +107,7 @@ function normaliseUrl(url) { url = url.replace("https://", "http://"); //hacky way to treat http and https the same const parsedUrl = Url.parse(url); - if (parsedUrl.host.includes("youtube.com")) { + if (parsedUrl.host && parsedUrl.host.includes("youtube.com")) { const videoIDParam = (parsedUrl.query || "").split("&").find(x => x.startsWith("v=")); if (videoIDParam) { const videoID = videoIDParam.substring(videoIDParam.indexOf("=") + 1, videoIDParam.length);