jp (common): fixed encoding issue in URLs

This commit is contained in:
Goffi 2017-07-13 21:45:26 +02:00
commit 5c7d273ebc

View file

@ -388,7 +388,7 @@ class BaseEdit(object):
# we have probably an URL, we try to parse it
import urlparse
url = self.args.item
parsed_url = urlparse.urlsplit(url)
parsed_url = urlparse.urlsplit(url.encode('utf-8'))
if parsed_url.scheme.startswith('http'):
self.disp(u"{} URL found, trying to find associated xmpp: URI".format(parsed_url.scheme.upper()),1)
# HTTP URL, we try to find xmpp: links
@ -418,14 +418,14 @@ class BaseEdit(object):
self.disp(u"XMPP URI used: {}".format(url),2)
# XXX: if we have not xmpp: URI here, we'll take the data as a file path
pubsub_service = parsed_url.path
pubsub_service = parsed_url.path.decode('utf-8')
pubsub_data = urlparse.parse_qs(parsed_url.query)
try:
pubsub_node = pubsub_data['node'][0]
pubsub_node = pubsub_data['node'][0].decode('utf-8')
except KeyError:
self.disp(u'No node found in xmpp: URI, can\'t retrieve item', error=True)
self.host.quit(1)
pubsub_item = pubsub_data.get('item',[None])[0]
pubsub_item = pubsub_data.get('item',[None])[0].decode('utf-8')
if pubsub_item is None and self.args.last_item:
command = 'last'
elif pubsub_item is not None: