fix(bridge): Use double quotes instead of shlex.quote for message args

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 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2025-12-28 15:55:42 +01:00
parent 56b7c335e8
commit 36badea5a2
+14 -2
View File
@@ -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,