From 8d11cd68f13d53ae010d63ae98fe44bb2061b6cd Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Mon, 5 Jul 2021 12:54:23 -0400 Subject: [PATCH] Better normalization of feeds with feed:// in the protocol. --- utils/urlnorm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/utils/urlnorm.py b/utils/urlnorm.py index 87d740730..8d0cf6dca 100644 --- a/utils/urlnorm.py +++ b/utils/urlnorm.py @@ -111,7 +111,15 @@ def normalize(url): if '://' not in url: url = 'http://' + url if url.startswith('feed://'): - url = url.replace('feed://', 'http://') + if 'http://' in url or 'https://' in url: + url = url.replace('feed:', '') + else: + url = url.replace('feed://', 'http://') + if url.startswith('feed:'): + if 'http://' in url or 'https://' in url: + url = url.replace('feed:', '') + else: + url = url.replace('feed:', 'http://') return url