Yann Leboulanger pushed to branch master at gajim / gajim
Commits: d129abbe by Philipp Hörist at 2017-01-03T20:17:14+01:00 Catch exceptions on invalid URLs
Closes #8494
Conflicts: src/common/helpers.py
- - - - -
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 @@ -143,8 +143,12 @@ def puny_encode_url(url): _url = url if '//' not in _url: _url = '//' + _url - o = urllib.parse.urlparse(_url) - p_loc = idn_to_ascii(o.netloc) + try: + o = urllib.parse.urlparse(_url) + p_loc = idn_to_ascii(o.netloc) + except Exception: + 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 @@ -1232,6 +1232,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/d129abbed6ea1e63544798a9bedc6d6cf99...