From f051a2f969faab6bc35f9ddfe938df5b5e34f8c6 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 27 Aug 2020 06:07:35 +0000 Subject: [PATCH] [FIX] web: /web/binary/upload Doesn't seem used since it's been broken forever on python 3: base64.b64encode returns binary data, on which json.dumps chokes. Still, removing the endpoint on old stables seems a bit brutal so just fix it. closes odoo/odoo#56650 X-original-commit: 7fc9bc28986d69184df5a4fdeefbe09e4b39b8f0 Signed-off-by: Xavier Morel (xmo) --- addons/web/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 1907064bd6b..061c1c57926 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1544,7 +1544,7 @@ class Binary(http.Controller): try: data = ufile.read() args = [len(data), ufile.filename, - ufile.content_type, base64.b64encode(data)] + ufile.content_type, pycompat.to_text(base64.b64encode(data))] except Exception as e: args = [False, str(e)] return out % (json.dumps(callback), json.dumps(args)) if callback else json.dumps(args)