Strip encoded attachment metadata delimiters

TerminallyLazy committed Aug 10, 2026 at 21:08 UTC efdb5f4aca02481d9c214e46fd9946356668cbf5
2 files changed +10
plugins/_a0_connector/api/ws_connector.py
+1
@@ -88,6 +88,7 @@ def _attachment_log_metadata(attachments: list[str]) -> dict[str, list[str]]:
88 continue
89 path = parsed.path if parsed.scheme else normalized.split("?", 1)[0].split("#", 1)[0]
90 path = unquote(path).replace("\\", "/")
91 + path = path.split("?", 1)[0].split("#", 1)[0]
92 if path.endswith("/"):
93 continue
94 name = path.rstrip("/").rsplit("/", 1)[-1]
tests/test_a0_connector_attachment_metadata.py
+9
@@ -43,6 +43,15 @@ def test_attachment_log_metadata_decodes_encoded_separators() -> None:
43 ) == {"attachments": ["secret.png", "secret.png"]}
44
45
46 +def test_attachment_log_metadata_strips_encoded_query_and_fragment_suffixes() -> None:
47 + assert _attachment_log_metadata(
48 + [
49 + "https://host/report%3Ftoken%3Dsecret.png",
50 + "https://host/image%23private-fragment.png",
51 + ]
52 + ) == {"attachments": ["report", "image"]}
53 +
54 +
55 class RecordingLog:
56 def __init__(self) -> None:
57 self.calls: list[dict[str, object]] = []