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
2 changed files:
Changes:
| ... | ... | @@ -145,8 +145,12 @@ def puny_encode_url(url): |
| 145 | 145 |
_url = url
|
| 146 | 146 |
if '//' not in _url:
|
| 147 | 147 |
_url = '//' + _url
|
| 148 |
- o = urlparse(_url)
|
|
| 149 |
- p_loc = idn_to_ascii(o.netloc)
|
|
| 148 |
+ try:
|
|
| 149 |
+ o = urlparse(_url)
|
|
| 150 |
+ p_loc = idn_to_ascii(o.netloc)
|
|
| 151 |
+ except:
|
|
| 152 |
+ log.debug('urlparse failed: %s', url)
|
|
| 153 |
+ return False
|
|
| 150 | 154 |
return url.replace(o.netloc, p_loc)
|
| 151 | 155 |
|
| 152 | 156 |
def parse_resource(resource):
|
| ... | ... | @@ -1220,6 +1220,8 @@ class ConversationTextview(gobject.GObject): |
| 1220 | 1220 |
puny_tags = []
|
| 1221 | 1221 |
if use_other_tags:
|
| 1222 | 1222 |
puny_tags += other_tags
|
| 1223 |
+ if not puny_text:
|
|
| 1224 |
+ puny_text = _('Invalid URL')
|
|
| 1223 | 1225 |
puny_tags = [(ttt.lookup(t) if isinstance(t, str) else t) for t in puny_tags]
|
| 1224 | 1226 |
buffer_.insert_with_tags(end_iter, " (%s)" % puny_text, *puny_tags)
|
| 1225 | 1227 |
|