fix parsing of empty links

For some obscure reason, with the test feed provided in #5, the
resulting link is no available in the feed at all, which crashes the
normalize routine. That is because urlparse.urlsplit returns a
different type on strings (which are used in the normal path) or
"None" (which is used when the link is not present).

We fix this by defaulting to the empty string, although this probably
means that feed2exec will have trouble adapting to that feed in the
first place, but that's another bug.

Closes: #5
parent b765461a
Pipeline #23876866 passed with stage
in 2 minutes and 18 seconds
......@@ -324,7 +324,7 @@ class Feed(feedparser.FeedParserDict):
item['id'] = item.get('title')
# 3. not completely absolute links
scheme, netloc, *rest = urlparse.urlsplit(item.get('link'))
scheme, netloc, *rest = urlparse.urlsplit(item.get('link', ''))
if not scheme:
# take missing scheme/host from feed URL
scheme, netloc, *_ = urlparse.urlsplit(self.get('url', ''))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment