open-webui/backend/open_webui
mia 9d3d80b9f8 fix: extract text from PDF URLs in fetch_url tool
When fetch_url fetches a PDF URL, the content was returned as garbled
binary because BeautifulSoup's HTML parser corrupted the PDF bytes.

Add three-layer PDF detection:
- Fast-path for URLs ending in .pdf (case-insensitive)
- Content-Type header detection in async SafeWebBaseLoader._fetch
- %PDF binary content fallback in get_content_from_url

Includes SSRF protection via validate_url(), streaming download with
Content-Length pre-check, 50 MB size limit, and proper session
management. No new dependencies (pypdf already in requirements.txt).

Closes #23841

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-19 11:07:02 +05:30
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac 2026-04-17 11:27:58 +09:00
migrations chore: format 2026-04-17 14:28:18 +09:00
models refac 2026-04-18 06:23:50 +09:00
retrieval fix: extract text from PDF URLs in fetch_url tool 2026-04-19 11:07:02 +05:30
routers perf: avoid redundant knowledge re-fetch in update_knowledge_access_by_id (#23799) 2026-04-17 14:44:42 +09:00
socket refac 2026-04-17 13:29:51 +09:00
static refac 2026-03-23 23:39:52 -05:00
storage refac 2026-04-12 19:08:30 -05:00
test refac 2026-03-17 17:58:01 -05:00
tools refac 2026-04-17 12:55:56 +09:00
utils refac 2026-04-17 15:01:42 +09:00
__init__.py refac (#22987) 2026-03-24 15:41:26 -05:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py feat: add RAG_RERANKING_BATCH_SIZE configuration option 2026-04-17 08:35:45 +09:00
constants.py chore: format 2026-04-14 17:27:31 -05:00
env.py refac 2026-04-17 11:27:58 +09:00
functions.py refac 2026-04-17 14:15:36 +09:00
main.py refac 2026-04-17 14:15:36 +09:00
tasks.py refac 2026-03-17 17:58:01 -05:00