mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-06 16:53:21 +02:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user