hermes-agent/tests/gateway/test_strip_markdown_links.py
teknium1 73ba639092 fix(imessage): strip markdown on every Photon plain send and keep link URLs on BlueBubbles
Follow-up on the two salvaged commits:
- One _sidecar_payload_text() helper decides the /send text for both the adapter
  path and _standalone_send (cron / send_message), which had the same raw-markdown
  leak on URL-bearing messages and never stripped with PHOTON_MARKDOWN=false.
- BlueBubbles (same iMessage surface) keeps [label](url) targets as bare URLs.
- Tests trimmed to two invariants.
2026-09-23 03:10:15 -07:00

9 lines
573 B
Python

"""``strip_markdown`` link handling: the default drops a link target (SMS, IRC, Feishu, QQ rely on it);
``keep_link_targets=True`` leaves a bare http(s) URL for platforms whose data detection re-links it."""
from gateway.platforms.helpers import strip_markdown
def test_keep_link_targets_keeps_http_urls_only() -> None:
text = "see [Open it](https://example.com/i?x=1) or [mail](mailto:[email protected])"
assert strip_markdown(text) == "see Open it or mail"
assert strip_markdown(text, keep_link_targets=True) == "see Open it\nhttps://example.com/i?x=1 or mail"