From 36badea5a21db5e2214226f1f498adcb4bc32412 Mon Sep 17 00:00:00 2001 From: MarekWo Date: Sun, 28 Dec 2025 15:55:42 +0100 Subject: [PATCH] fix(bridge): Use double quotes instead of shlex.quote for message args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users reported single quotes appearing in sent messages. shlex.quote() uses single quotes which meshcli treats literally. Changes: - Replace shlex.quote() with custom double-quote wrapping - Only quote args containing spaces or special chars - Escape internal double quotes with backslash - Example: ['public', 'To jest test'] → 'public "To jest test"' meshcli should strip double quotes but preserve content. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- meshcore-bridge/bridge.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/meshcore-bridge/bridge.py b/meshcore-bridge/bridge.py index 3adee7e..dbcd854 100644 --- a/meshcore-bridge/bridge.py +++ b/meshcore-bridge/bridge.py @@ -326,8 +326,20 @@ class MeshCLISession: Dict with success, stdout, stderr, returncode """ cmd_id = str(uuid.uuid4())[:8] - # Properly quote arguments containing spaces/special chars - command = ' '.join(shlex.quote(arg) for arg in args) + + # Build command line - use double quotes for args with spaces/special chars + # meshcli doesn't parse like shell, so we need simple double-quote wrapping + quoted_args = [] + for arg in args: + # If argument contains spaces or special chars, wrap in double quotes + if ' ' in arg or '"' in arg or "'" in arg: + # Escape internal double quotes + escaped = arg.replace('"', '\\"') + quoted_args.append(f'"{escaped}"') + else: + quoted_args.append(arg) + + command = ' '.join(quoted_args) event = threading.Event() response_dict = { "event": event,