jp (common): fixed encoding issue in URLs
This commit is contained in:
parent
d5908b6ee6
commit
5c7d273ebc
1 changed files with 4 additions and 4 deletions
|
|
@ -388,7 +388,7 @@ class BaseEdit(object):
|
||||||
# we have probably an URL, we try to parse it
|
# we have probably an URL, we try to parse it
|
||||||
import urlparse
|
import urlparse
|
||||||
url = self.args.item
|
url = self.args.item
|
||||||
parsed_url = urlparse.urlsplit(url)
|
parsed_url = urlparse.urlsplit(url.encode('utf-8'))
|
||||||
if parsed_url.scheme.startswith('http'):
|
if parsed_url.scheme.startswith('http'):
|
||||||
self.disp(u"{} URL found, trying to find associated xmpp: URI".format(parsed_url.scheme.upper()),1)
|
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
|
# HTTP URL, we try to find xmpp: links
|
||||||
|
|
@ -418,14 +418,14 @@ class BaseEdit(object):
|
||||||
|
|
||||||
self.disp(u"XMPP URI used: {}".format(url),2)
|
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
|
# 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)
|
pubsub_data = urlparse.parse_qs(parsed_url.query)
|
||||||
try:
|
try:
|
||||||
pubsub_node = pubsub_data['node'][0]
|
pubsub_node = pubsub_data['node'][0].decode('utf-8')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.disp(u'No node found in xmpp: URI, can\'t retrieve item', error=True)
|
self.disp(u'No node found in xmpp: URI, can\'t retrieve item', error=True)
|
||||||
self.host.quit(1)
|
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:
|
if pubsub_item is None and self.args.last_item:
|
||||||
command = 'last'
|
command = 'last'
|
||||||
elif pubsub_item is not None:
|
elif pubsub_item is not None:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue