From 823670d9fa925255d3ebf28e55779b8be45a1c3a Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 16 Oct 2026 12:09:08 +0200 Subject: [PATCH] fix: arXiv PDF links reach the model as raw bytes (#32524) Files read from a URL are sent to a document parser based on their file name. An arXiv link like arxiv.org/pdf/1706.03762 has a dot in the paper ID, so the name was read as having the extension ".03762", the PDF went to the plain text reader and the model got raw PDF bytes. When the part after the dot is not a known file type, the extension now comes from the file type the server reports, so these links are read as PDFs. Files the server only labels as generic binary keep their name as before. --- backend/open_webui/retrieval/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/open_webui/retrieval/utils.py b/backend/open_webui/retrieval/utils.py index 8f5c080298..7017da7c2e 100644 --- a/backend/open_webui/retrieval/utils.py +++ b/backend/open_webui/retrieval/utils.py @@ -120,6 +120,9 @@ def _extract_text_from_binary_response( if not filename or '.' not in filename: ext = mimetypes.guess_extension(content_type) or '' filename = f'download{ext}' + elif not mimetypes.guess_type(filename)[0] and content_type != 'application/octet-stream': + # The dot in names like arXiv's 1706.03762 is not an extension. + filename += mimetypes.guess_extension(content_type) or '' suffix = '.' + filename.split('.')[-1].lower() if '.' in filename else ''