From 309844aea07936de51cd7fcfbc3b6d8aca2df49b Mon Sep 17 00:00:00 2001 From: Subhaditya Nath Date: Wed, 6 Jan 2021 11:17:54 +0530 Subject: [PATCH] v0.0.38: Critical bugfix --- .binary_version | 2 +- binary.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.binary_version b/.binary_version index 8800eda..6367b60 100644 --- a/.binary_version +++ b/.binary_version @@ -1 +1 @@ -v0.0.37 +v0.0.38 diff --git a/binary.py b/binary.py index 5da3fed..bb0138e 100644 --- a/binary.py +++ b/binary.py @@ -19,7 +19,7 @@ from simple_websocket_server import WebSocket from simple_websocket_server import WebSocketServer -BUILD_VERSION: str = "v0.0.37" +BUILD_VERSION: str = "v0.0.38" # TEMP_FILEPATH is used to store the port of the currently running server TEMP_FILEPATH: str = os.path.join(tempfile.gettempdir(), "nvim-ghost.nvim.port") @@ -178,14 +178,12 @@ def _ghost_responder(self): if neovim_focused_address is None: # There's no neovim instance to handle our request return - payload = ( - """\ -{ + # In f-strings, to insert literal {, we need to escape it using another { + # So {{ translates to a single literal { + payload = f"""{{ "ProtocolVersion": 1, - "WebSocketPort": {%s} -}""" - % servers.websocket_server.port - ) + "WebSocketPort": {servers.websocket_server.port} +}}""" self.send_response(200) self.send_header("Content-Type", "application/json") self.end_headers()