mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 01:07:31 +08:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user