[tor-commits] [bridgedb/develop] Fix str/bytes issue in serving of QR code.

phw at torproject.org phw at torproject.org
Wed Feb 19 18:27:18 UTC 2020


commit 63ffb833e2592558265d5b23b8b0e1d146daaae7
Author: Philipp Winter <phw at nymity.ch>
Date:   Fri Feb 14 10:06:46 2020 -0800

    Fix str/bytes issue in serving of QR code.
---
 bridgedb/distributors/https/server.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bridgedb/distributors/https/server.py b/bridgedb/distributors/https/server.py
index 98b31d0..503744e 100644
--- a/bridgedb/distributors/https/server.py
+++ b/bridgedb/distributors/https/server.py
@@ -1066,7 +1066,9 @@ class BridgesResource(CustomErrorHandlingResource, CSPResource):
             qrjpeg = generateQR(bridgeLines)
 
             if qrjpeg:
-                qrcode = 'data:image/jpeg;base64,%s' % base64.b64encode(qrjpeg)
+                qrcode = b'data:image/jpeg;base64,%s' % base64.b64encode(qrjpeg)
+                qrcode = qrcode.decode("utf-8")
+
             try:
                 langs = translations.getLocaleFromHTTPRequest(request)
                 rtl = translations.usingRTLLang(langs)





More information about the tor-commits mailing list