diff --git a/gateway/platforms/telegram.py b/gateway/platforms/telegram.py index 01bcf4da9..67be808be 100644 --- a/gateway/platforms/telegram.py +++ b/gateway/platforms/telegram.py @@ -2075,7 +2075,7 @@ class TelegramAdapter(BasePlatformAdapter): url = m.group(2).replace('\\', '\\\\').replace(')', '\\)') return _ph(f'[{display}]({url})') - text = re.sub(r'\[([^\]]+)\]\(([^)]+)\)', _convert_link, text) + text = re.sub(r'\[([^\]]+)\]\(([^()]*(?:\([^()]*\)[^()]*)*)\)', _convert_link, text) # 4) Convert markdown headers (## Title) → bold *Title* def _convert_header(m):