Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim
Commits: 16fbcf70 by Philipp Hörist at 2016-12-29T00:34:13+01:00 Catch exceptions on invalid URLs
Closes #8494
- - - - -
2 changed files:
- src/common/helpers.py - src/conversation_textview.py
Changes:
===================================== src/common/helpers.py ===================================== --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -145,8 +145,12 @@ def puny_encode_url(url): _url = url if '//' not in _url: _url = '//' + _url - o = urlparse(_url) - p_loc = idn_to_ascii(o.netloc) + try: + o = urlparse(_url) + p_loc = idn_to_ascii(o.netloc) + except: + log.debug('urlparse failed: %s', url) + return False return url.replace(o.netloc, p_loc)
def parse_resource(resource):
===================================== src/conversation_textview.py ===================================== --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -1220,6 +1220,8 @@ class ConversationTextview(gobject.GObject): puny_tags = [] if use_other_tags: puny_tags += other_tags + if not puny_text: + puny_text = _('Invalid URL') puny_tags = [(ttt.lookup(t) if isinstance(t, str) else t) for t in puny_tags] buffer_.insert_with_tags(end_iter, " (%s)" % puny_text, *puny_tags)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/16fbcf70230afc1663046b96c7dd477c63e...