Yann Leboulanger pushed to branch master at gajim / gajim
Commits:
-
d129abbe
by Philipp Hörist at 2017-01-03T20:17:14+01:00
2 changed files:
Changes:
| ... | ... | @@ -143,8 +143,12 @@ def puny_encode_url(url): |
| 143 | 143 |
_url = url
|
| 144 | 144 |
if '//' not in _url:
|
| 145 | 145 |
_url = '//' + _url
|
| 146 |
- o = urllib.parse.urlparse(_url)
|
|
| 147 |
- p_loc = idn_to_ascii(o.netloc)
|
|
| 146 |
+ try:
|
|
| 147 |
+ o = urllib.parse.urlparse(_url)
|
|
| 148 |
+ p_loc = idn_to_ascii(o.netloc)
|
|
| 149 |
+ except Exception:
|
|
| 150 |
+ log.debug('urlparse failed: %s', url)
|
|
| 151 |
+ return False
|
|
| 148 | 152 |
return url.replace(o.netloc, p_loc)
|
| 149 | 153 |
|
| 150 | 154 |
def parse_resource(resource):
|
| ... | ... | @@ -1232,6 +1232,8 @@ class ConversationTextview(GObject.GObject): |
| 1232 | 1232 |
puny_tags = []
|
| 1233 | 1233 |
if use_other_tags:
|
| 1234 | 1234 |
puny_tags += other_tags
|
| 1235 |
+ if not puny_text:
|
|
| 1236 |
+ puny_text = _('Invalid URL')
|
|
| 1235 | 1237 |
puny_tags = [(ttt.lookup(t) if isinstance(t, str) else t) for t in puny_tags]
|
| 1236 | 1238 |
buffer_.insert_with_tags(end_iter, " (%s)" % puny_text, *puny_tags)
|
| 1237 | 1239 |
|