Browse Source

Fix crash if articles contain urls with invalid host names

shorten
benji7425 3 years ago
parent
commit
987473ffa6
  1. 1
      CHANGELOG.md
  2. 2
      app/models/feed-data.js

1
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

2
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);

Loading…
Cancel
Save