Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(telegram): detect remote media types with queries
Gianfranco Demarco9214390f9d44
diff --git a/nanobot/channels/telegram/runtime.py b/nanobot/channels/telegram/runtime.pyindex de82cfb13..e00593840 100644--- a/nanobot/channels/telegram/runtime.py+++ b/nanobot/channels/telegram/runtime.py@@ -871,7 +871,8 @@ class TelegramChannel(BaseChannel):@staticmethoddef _get_media_type(path: str) -> str:"""Guess media type from file extension."""- ext = path.rsplit(".", 1)[-1].lower() if "." in path else ""+ filename = urlparse(path).path if path.startswith(("http://", "https://")) else path+ ext = filename.rsplit(".", 1)[-1].lower() if "." in filename else ""if ext in ("jpg", "jpeg", "png", "gif", "webp"):return "photo"if ext in ("mp4", "mov", "avi", "mkv", "webm", "3gp"):diff --git a/nanobot/channels/telegram/tests/test_telegram_channel.py b/nanobot/channels/telegram/tests/test_telegram_channel.pyindex b636d9e24..dd618464c 100644--- a/nanobot/channels/telegram/tests/test_telegram_channel.py+++ b/nanobot/channels/telegram/tests/test_telegram_channel.py@@ -1920,7 +1920,7 @@ async def test_send_remote_media_url_after_security_validation(monkeypatch) -> Nchannel="telegram",chat_id="123",content="",- media=["https://example.com/cat.jpg"],+ media=["https://example.com/cat.jpg?width=672"],))@@ -1928,7 +1928,7 @@ async def test_send_remote_media_url_after_security_validation(monkeypatch) -> N{"kind": "photo","chat_id": 123,- "photo": "https://example.com/cat.jpg",+ "photo": "https://example.com/cat.jpg?width=672","reply_parameters": None,}]