From 5d683da38f577a66a3ae7f1ceacbcdffcb4c56df Mon Sep 17 00:00:00 2001 From: "Aleksander W. Oleszkiewicz (Alek)" <24917047+alekwo@users.noreply.github.com> Date: Mon, 16 Feb 2026 09:53:20 +0100 Subject: [PATCH] Fix regex for URL and image URL formatting --- nanobot/channels/slack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nanobot/channels/slack.py b/nanobot/channels/slack.py index 6b685d1..ef78887 100644 --- a/nanobot/channels/slack.py +++ b/nanobot/channels/slack.py @@ -233,11 +233,11 @@ class SlackChannel(BaseChannel): # Convert URL formatting # Step 6: [text](URL) -> converted_text = re.sub( - r"(^|[^!])\[(.+?)\]\((http.+?)\)", r"<\2|\1>", converted_text) + r"(^|[^!])\[(.+?)\]\((http.+?)\)", r"\1<\3|\2>", converted_text) # Convert image URL # Step 6: ![alt text](URL "title") -> converted_text = re.sub( - r"[!]\[.+?\]\((http.+?)(?: \".*?\")?\)", r"<\2>", converted_text) + r"[!]\[.+?\]\((http.+?)(?: \".*?\")?\)", r"<\1>", converted_text) return converted_text def escape_mrkdwn(text: str) -> str: return (text.replace('&', '&')