diff sat/plugins/plugin_xep_0277.py @ 3069:73db9db8b9e1

plugin XEP-0277: fixed comments URLs parsing
author Goffi <goffi@goffi.org>
date Fri, 08 Nov 2019 11:55:21 +0100
parents ab2696e34d29
children 9d0df638c8b4
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0277.py	Fri Nov 08 11:47:42 2019 +0100
+++ b/sat/plugins/plugin_xep_0277.py	Fri Nov 08 11:55:21 2019 +0100
@@ -365,8 +365,8 @@
                 microblog_data[key] = link_elt["href"]
                 try:
                     service, node = self.parseCommentUrl(microblog_data[key])
-                except:
-                    log.warning("Can't parse url {}".format(microblog_data[key]))
+                except Exception as e:
+                    log.warning(f"Can't parse url {microblog_data[key]}: {e}")
                     del microblog_data[key]
                 else:
                     microblog_data["{}_service".format(key)] = service.full()
@@ -853,7 +853,7 @@
         """
         parsed_url = urllib.parse.urlparse(node_url, "xmpp")
         service = jid.JID(parsed_url.path)
-        parsed_queries = urllib.parse.parse_qs(parsed_url.query.encode("utf-8"))
+        parsed_queries = urllib.parse.parse_qs(parsed_url.query)
         node = parsed_queries.get("node", [""])[0]
 
         if not node: