From 0dcea4a7e72cb7a0e4489b9b24b9f5eb621a11f5 Mon Sep 17 00:00:00 2001 From: egg Date: Tue, 2 Dec 2025 18:12:22 +0800 Subject: [PATCH] fix: use task.files relationship to get source file path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task model doesn't have file_path attribute directly. Use the files relationship to access TaskFile.stored_path for source file path. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/app/routers/translate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/app/routers/translate.py b/backend/app/routers/translate.py index fd68f65..69e75b2 100644 --- a/backend/app/routers/translate.py +++ b/backend/app/routers/translate.py @@ -596,8 +596,10 @@ async def download_translated_pdf( try: # Get source file path for images if available source_file_path = None - if task.file_path and Path(task.file_path).exists(): - source_file_path = Path(task.file_path) + if task.files and len(task.files) > 0: + stored_path = task.files[0].stored_path + if stored_path and Path(stored_path).exists(): + source_file_path = Path(stored_path) success = pdf_generator_service.generate_translated_pdf( result_json_path=result_json_path,