db-move: moved linux-zen from [testing] to [extra] (x86_64)
[arch-packages.git] / avahi / repos / extra-x86_64 / 282.patch
blob9e38ad06cee70f9ee49fc31dec19dac44a3f703f
1 From bcafdcc5465091b6088532460b671f411703f90b Mon Sep 17 00:00:00 2001
2 From: Simon McVittie <smcv@debian.org>
3 Date: Fri, 24 Apr 2020 11:25:41 +0100
4 Subject: [PATCH] avahi-discover: Don't decode unicode strings, only
5 bytestrings
7 Unicode strings (unicode in Python 2, str or unicode in Python 3) don't
8 have a decode method; only bytestrings (str or bytes in Python 2,
9 bytes in Python 3) have that. Decode exactly the strings that need
10 decoding.
12 Resolves: https://github.com/lathiat/avahi/issues/275
13 Signed-off-by: Simon McVittie <smcv@debian.org>
14 ---
15 avahi-python/avahi-discover/avahi-discover.py | 8 +++++---
16 1 file changed, 5 insertions(+), 3 deletions(-)
18 diff --git a/avahi-python/avahi-discover/avahi-discover.py b/avahi-python/avahi-discover/avahi-discover.py
19 index 4a2b5756..fddf4a51 100755
20 --- a/avahi-python/avahi-discover/avahi-discover.py
21 +++ b/avahi-python/avahi-discover/avahi-discover.py
22 @@ -238,15 +238,17 @@ def update_label(self,interface, protocol, name, stype, domain, host, aprotocol,
23 txts+="<b>" + _("TXT") + " <i>%s</i></b> = %s\n" % (k,v)
24 else:
25 txts = "<b>" + _("TXT Data:") + "</b> <i>" + _("empty") + "</i>"
27 - txts = txts.decode("utf-8")
29 + if isinstance(txts, bytes): # Python 2
30 + txts = txts.decode("utf-8")
32 infos = "<b>" + _("Service Type:") + "</b> %s\n"
33 infos += "<b>" + _("Service Name:") + "</b> %s\n"
34 infos += "<b>" + _("Domain Name:") + "</b> %s\n"
35 infos += "<b>" + _("Interface:") + "</b> %s %s\n"
36 infos += "<b>" + _("Address:") + "</b> %s/%s:%i\n%s"
37 - infos = infos.decode("utf-8")
38 + if isinstance(infos, bytes): # Python 2
39 + infos = infos.decode("utf-8")
40 infos = infos % (stype, name, domain, self.siocgifname(interface), self.protoname(protocol), host, address, port, txts.strip())
41 self.info_label.set_markup(infos)