diff --git a/social/feedparser/32-feedparse.js b/social/feedparser/32-feedparse.js index 1a3f558f..30cab161 100644 --- a/social/feedparser/32-feedparse.js +++ b/social/feedparser/32-feedparse.js @@ -18,6 +18,7 @@ module.exports = function(RED) { "use strict"; var FeedParser = require("feedparser"); var request = require("request"); + var url = require('url'); function FeedParseNode(n) { RED.nodes.createNode(this,n); @@ -26,7 +27,10 @@ module.exports = function(RED) { var node = this; this.interval_id = null; this.seen = {}; - if (this.url !== "") { + var parsedUrl = url.parse(this.url); + if (!(parsedUrl.host || (parsedUrl.hostname && parsedUrl.port)) && !parsedUrl.isUnix) { + this.error(RED._("feedparse.errors.invalidurl")); + } else { var getFeed = function() { var req = request(node.url, {timeout: 10000, pool: false}); //req.setMaxListeners(50); @@ -64,8 +68,6 @@ module.exports = function(RED) { }; this.interval_id = setInterval(function() { getFeed(); }, node.interval); getFeed(); - } else { - this.error(RED._("feedparse.errors.invalidurl")); } this.on("close", function() { diff --git a/social/feedparser/package.json b/social/feedparser/package.json index 5fab0d50..b5725756 100644 --- a/social/feedparser/package.json +++ b/social/feedparser/package.json @@ -1,10 +1,10 @@ { "name": "node-red-node-feedparser", - "version": "0.1.2", + "version": "0.1.3", "description": "A Node-RED node to get RSS Atom feeds.", "dependencies": { "feedparser": "1.1.3", - "request": "2.61.0" + "request": "2.65.0" }, "repository": { "type": "git",