From 330b16ae06e9e6e9ed35f5c89c8980e9a9b0bd92 Mon Sep 17 00:00:00 2001 From: phact Date: Tue, 7 Oct 2025 02:00:57 -0400 Subject: [PATCH] preserve file name for upload --- src/services/document_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/document_service.py b/src/services/document_service.py index 5204ea0e..d596fb25 100644 --- a/src/services/document_service.py +++ b/src/services/document_service.py @@ -126,7 +126,11 @@ class DocumentService: from utils.file_utils import auto_cleanup_tempfile import os - with auto_cleanup_tempfile() as tmp_path: + # Preserve file extension for docling format detection + filename = upload_file.filename or "uploaded" + suffix = os.path.splitext(filename)[1] or "" + + with auto_cleanup_tempfile(suffix=suffix) as tmp_path: # Stream upload file to temporary file file_size = 0 with open(tmp_path, 'wb') as tmp_file: