From 4916077fb1f3c70554079d61b220f783f20128b1 Mon Sep 17 00:00:00 2001 From: Daniel Aleksandersen Date: Tue, 4 Sep 2018 12:45:29 +0200 Subject: [PATCH] Keep origin protocol when converting to feed URI Avoid downgrading HTTP to HTTPS. Introduces security and privacy risks; plus reduces performance with unnecessary redirects. --- Safari Extension/netnewswire-subscribe-to-feed.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Safari Extension/netnewswire-subscribe-to-feed.js b/Safari Extension/netnewswire-subscribe-to-feed.js index 576c4c49b..5a05d25fe 100644 --- a/Safari Extension/netnewswire-subscribe-to-feed.js +++ b/Safari Extension/netnewswire-subscribe-to-feed.js @@ -65,13 +65,9 @@ function subscribeToFeed(theFeed) { // in the PageLoadEnd.js so we can be more confident it's a // good feed: URL. var feedURL = theFeed.href; - if (feedURL.match(/^http[s]?:\/\//)) + if (!feedURL.startsWith('feed:')) { - feedURL = feedURL.replace(/^http[s]?:\/\//, "feed://"); - } - else if (feedURL.match(/^feed:/) == false) - { - feedURL = "feed:" + feedURL; + feedURL = 'feed:' + feedURL; } safari.extension.dispatchMessage("subscribeToFeed", { "url": feedURL });