plugin XEP-0060: fixed bad xmpp: URI generation in getNodeURI

This commit is contained in:
Goffi 2016-02-25 16:21:17 +01:00
commit 413af63280
2 changed files with 5 additions and 2 deletions

View file

@ -410,10 +410,13 @@ class XEP_0060(object):
@param node(unicode): node
@return (unicode): URI of the node
"""
# XXX: urllib.urlencode use "&" to separate value, while XMPP URL (cf. RFC 5122)
# use ";" as a separator. So if more than one value is used in query_data,
# urlencode MUST NOT BE USED.
query_data = [('node', node.encode('utf-8'))]
if item is not None:
query_data.append(('item', item.encode('utf-8')))
return "xmpp:{service}?{query}".format(
return "xmpp:{service}?;{query}".format(
service=service.userhost(),
query=urllib.urlencode(query_data)
).decode('utf-8')

View file

@ -611,7 +611,7 @@ class XEP_0277(object):
Determine the fields comments_service and comments_node of a microblog data
from the href attribute of an entry's link element. For example this input:
xmpp:sat-pubsub.libervia.org?node=urn%3Axmpp%3Acomments%3A_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn%3Axmpp%3Agroupblog%3Asouliane%40libervia.org
xmpp:sat-pubsub.libervia.org?;node=urn%3Axmpp%3Acomments%3A_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn%3Axmpp%3Agroupblog%3Asouliane%40libervia.org
will return (JID(u'sat-pubsub.libervia.org'), 'urn:xmpp:comments:_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn:xmpp:groupblog:souliane@libervia.org')
@return: a tuple (JID, str)
"""