From 58e3160cf115379878541b77f7ba3cd44b7402f7 Mon Sep 17 00:00:00 2001 From: Open Source Contributor Date: Sat, 25 Apr 2026 23:17:44 -0600 Subject: [PATCH] fix: add follow_redirects and timeout to URL attachment fetching URL-based attachments were failing on redirects or hanging on slow connections because httpx.get/head lacked explicit parameters. --- llm/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llm/models.py b/llm/models.py index 892a4f2ba..2ec41b119 100644 --- a/llm/models.py +++ b/llm/models.py @@ -84,7 +84,7 @@ def resolve_type(self): if self.path: return mimetype_from_path(self.path) if self.url: - response = httpx.head(self.url) + response = httpx.head(self.url, follow_redirects=True, timeout=30.0) response.raise_for_status() return response.headers.get("content-type") if self.content: @@ -98,7 +98,7 @@ def content_bytes(self): if self.path: content = Path(self.path).read_bytes() elif self.url: - response = httpx.get(self.url) + response = httpx.get(self.url, follow_redirects=True, timeout=30.0) response.raise_for_status() content = response.content return content