From 391eac2447e78cc02a98d6b184f3e89f5cdd4946 Mon Sep 17 00:00:00 2001 From: vifo Date: Wed, 29 Nov 2023 09:59:50 +0100 Subject: [PATCH] [FIX] iot: Build the url of iot_channel with dumps Before, the url was built with string comprehension. Now json.dumps is use to ensure that the JSON sent is valid closes odoo/odoo#144125 Signed-off-by: Quentin Lejeune (qle) --- addons/hw_drivers/websocket_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hw_drivers/websocket_client.py b/addons/hw_drivers/websocket_client.py index e11257e7c29..436e1063758 100644 --- a/addons/hw_drivers/websocket_client.py +++ b/addons/hw_drivers/websocket_client.py @@ -61,7 +61,7 @@ class WebsocketClient(Thread): When the client is setup, this function send a message to subscribe to the iot websocket channel """ ws.send( - '{"event_name":"subscribe","data":{"channels":["' + self.iot_channel + '"],"last":0}}' + json.dumps({'event_name': 'subscribe', 'data': {'channels':[self.iot_channel], 'last': 0}}) ) def __init__(self, url):