mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
RSS: Don't crash on load if there is an invalid feed name. Closes GH-1116.
This commit is contained in:
parent
517dc16612
commit
34138b9185
@ -75,6 +75,9 @@ def only_one_at_once(f):
|
|||||||
lock[0] = False
|
lock[0] = False
|
||||||
return newf
|
return newf
|
||||||
|
|
||||||
|
class InvalidFeedUrl(ValueError):
|
||||||
|
pass
|
||||||
|
|
||||||
class Feed:
|
class Feed:
|
||||||
__slots__ = ('url', 'name', 'data', 'last_update', 'entries',
|
__slots__ = ('url', 'name', 'data', 'last_update', 'entries',
|
||||||
'etag', 'modified', 'initial',
|
'etag', 'modified', 'initial',
|
||||||
@ -83,7 +86,8 @@ class Feed:
|
|||||||
plugin_is_loading=False, announced=None):
|
plugin_is_loading=False, announced=None):
|
||||||
assert name, name
|
assert name, name
|
||||||
if not url:
|
if not url:
|
||||||
assert utils.web.httpUrlRe.match(name), name
|
if not utils.web.httpUrlRe.match(name)
|
||||||
|
raise InvalidFeedUrl(name)
|
||||||
url = name
|
url = name
|
||||||
self.name = name
|
self.name = name
|
||||||
self.url = url
|
self.url = url
|
||||||
@ -167,7 +171,11 @@ class RSS(callbacks.Plugin):
|
|||||||
except registry.NonExistentRegistryEntry:
|
except registry.NonExistentRegistryEntry:
|
||||||
self.log.warning('%s is not a registered feed, removing.',name)
|
self.log.warning('%s is not a registered feed, removing.',name)
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
self.register_feed(name, url, True, True, announced.get(name, []))
|
self.register_feed(name, url, True, True, announced.get(name, []))
|
||||||
|
except InvalidFeedUrl:
|
||||||
|
self.log.error('%s is not a valid feed, removing.', name)
|
||||||
|
continue
|
||||||
world.flushers.append(self._flush)
|
world.flushers.append(self._flush)
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user