Fix crash if articles contain urls with invalid host names
This commit is contained in:
parent
96def786a4
commit
987473ffa6
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Fixed
|
### 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...)
|
- Temporary fix for bot crash if used with a feed without links in the articles (didn't realise this was possible...)
|
||||||
|
|
||||||
## v3.1.3
|
## v3.1.3
|
||||||
|
|
|
@ -107,7 +107,7 @@ function normaliseUrl(url) {
|
||||||
url = url.replace("https://", "http://"); //hacky way to treat http and https the same
|
url = url.replace("https://", "http://"); //hacky way to treat http and https the same
|
||||||
|
|
||||||
const parsedUrl = Url.parse(url);
|
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="));
|
const videoIDParam = (parsedUrl.query || "").split("&").find(x => x.startsWith("v="));
|
||||||
if (videoIDParam) {
|
if (videoIDParam) {
|
||||||
const videoID = videoIDParam.substring(videoIDParam.indexOf("=") + 1, videoIDParam.length);
|
const videoID = videoIDParam.substring(videoIDParam.indexOf("=") + 1, videoIDParam.length);
|
||||||
|
|
Loading…
Reference in a new issue