From cfaeaba39c02a0b1bdcf12a1201d37c16cd2cff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 11 Dec 2020 14:38:07 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Better=20fix=20for=20#3875?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of encoding twice, encode only once with the right parameters --- src/octoprint/server/util/sockjs.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index 7e43f5ff8..c0c7bf1f7 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -71,6 +71,7 @@ class JsonEncodingSessionWrapper(wrapt.ObjectProxy): octoprint.vendor.sockjs.tornado.util.bytes_to_str(msg), separators=(",", ":"), default=JsonEncoding.encode, + allow_nan=False, ), stats, ) @@ -589,9 +590,6 @@ class PrinterStateConnection( def _do_emit(self, type, payload): try: - import json - - _ = json.dumps(octoprint.util.thaw_frozendict({type: payload}), allow_nan=False) self.send({type: payload}) except Exception as e: if self._logger.isEnabledFor(logging.DEBUG):