fix(gateway): reject file paths in get_command() + add file-drop tests

Gateway's get_command() treated /path/to/file as command 'path' because
it had no / check after stripping the leading slash. The CLI already
solved this with _looks_like_slash_command() but the gateway adapter
layer was never patched.

Adds the same heuristic to MessageEvent.get_command(): valid command
names never contain /, file paths always do.

Also adds 28 regression tests for the CLI's _detect_file_drop().

Gateway fix from #6978 (@ygd58), tests from #6963 (@betamod).
This commit is contained in:
Teknium
2026-04-10 13:05:24 -07:00
parent 7e28b7b5d5
commit 29e11d8ea3
2 changed files with 179 additions and 0 deletions

View File

@@ -613,6 +613,9 @@ class MessageEvent:
raw = parts[0][1:].lower() if parts else None
if raw and "@" in raw:
raw = raw.split("@", 1)[0]
# Reject file paths: valid command names never contain /
if raw and "/" in raw:
return None
return raw
def get_command_args(self) -> str: