The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): anchor attachment-ref strip and allow @ in paths
StanleyStetson4b78815cb53f
diff --git a/gateway/platforms/base.py b/gateway/platforms/base.pyindex 6c735e80b8b..dc7177c6eec 100644--- a/gateway/platforms/base.py+++ b/gateway/platforms/base.py@@ -1315,7 +1315,7 @@ MEDIA_EXTENSIONLESS_TAG_RE = re.compile(# a slash token from MessageEvent.is_command() / get_command().# The pattern matches to end-of-line (not just whitespace-bounded) to handle# Windows paths that may contain spaces (e.g. "C:\Users\John Doe\image.png").-_ATTACHMENT_REF_RE = re.compile(r"@(?:image|file|url):[^\n@]+", re.IGNORECASE)+_ATTACHMENT_REF_RE = re.compile(r"^(?:@(?:image|file|url):[^\n]+\n?)+", re.IGNORECASE)diff --git a/tests/gateway/test_platform_base.py b/tests/gateway/test_platform_base.pyindex 41c7e3e0da5..95678d32c2c 100644--- a/tests/gateway/test_platform_base.py+++ b/tests/gateway/test_platform_base.py@@ -104,6 +104,11 @@ class TestMessageEventIsCommand:event = MessageEvent(text="@url:https://example.com\n\n/status")assert event.is_command() is True+ def test_slash_command_with_at_in_ref_path(self):+ """Ref path containing @ (legal on Windows, e.g. john@doe) must be fully stripped."""+ event = MessageEvent(text="@image:C:\\Users\\john@doe\\photo.png\n\n/moa hi")+ assert event.is_command() is True+def test_non_command_with_image_ref(self):"""A regular message (no slash command) with an image ref must NOT be detected as a command."""event = MessageEvent(text="@image:/tmp/foo.png\n\nwhat is this?")@@ -134,6 +139,11 @@ class TestMessageEventGetCommandArgs:event = MessageEvent(text="/new session id 123")assert event.get_command_args() == "session id 123"+ def test_command_args_preserve_url_ref_in_args(self):+ """@url: tokens in the middle of command args must NOT be stripped."""+ event = MessageEvent(text="/status check @url:https://example.com")+ assert event.get_command_args() == "check @url:https://example.com"+# ---------------------------------------------------------------------------# extract_images