From 3a66aeeec5f3494dbc8fa71050159efbaf2b9daf Mon Sep 17 00:00:00 2001 From: curo1305 Date: Tue, 21 Apr 2026 11:48:04 +0200 Subject: [PATCH] fix: rename download_file import to storage_download to avoid shadow The route handler async def download_file() shadowed the storage import of the same name, causing the endpoint to call itself recursively. Co-Authored-By: Claude Sonnet 4.6 --- features/doc-service/app/routers/documents.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/doc-service/app/routers/documents.py b/features/doc-service/app/routers/documents.py index fd54855..9e4f797 100644 --- a/features/doc-service/app/routers/documents.py +++ b/features/doc-service/app/routers/documents.py @@ -29,7 +29,7 @@ from app.schemas.document import ( from app.schemas.share import DocumentShareCreate, DocumentShareOut, SharedDocumentOut from app.services.ai_client import AIServiceError, classify_document from app.services.config_reader import load_doc_config -from app.services.storage import delete_file, download_file, save_upload +from app.services.storage import delete_file, download_file as storage_download, save_upload router = APIRouter() @@ -146,7 +146,7 @@ async def process_document(doc_id: str) -> None: await db.commit() try: - pdf_bytes = await download_file(doc.storage_key) + pdf_bytes = await storage_download(doc.storage_key) text = await asyncio.to_thread(_extract_pdf_text, pdf_bytes) result = await classify_document(text) @@ -611,7 +611,7 @@ async def download_file( raise HTTPException(status_code=404, detail="Document not found") try: - pdf_bytes = await download_file(doc.storage_key) + pdf_bytes = await storage_download(doc.storage_key) except FileNotFoundError: raise HTTPException(status_code=404, detail="File not found in storage")