From 120648ac81c5e1ddef61eb8949a39631a62acf2c Mon Sep 17 00:00:00 2001 From: lys1313013 Date: Tue, 20 Jan 2026 12:24:54 +0800 Subject: [PATCH] fix: inaccurate error message when uploading multiple files containing an unsupported file type (#12711) ### What problem does this PR solve? When uploading multiple files at once, if any of the files are of an unsupported type and the blob is not removed, it triggers a TypeError('Object of type bytes is not JSON serializable') exception. This prevents the frontend from responding properly. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/document_app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 257506ec8..1267db9bc 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -87,6 +87,7 @@ async def upload(): err, files = await asyncio.to_thread(FileService.upload_document, kb, file_objs, current_user.id) if err: + files = [f[0] for f in files] if files else [] return get_json_result(data=files, message="\n".join(err), code=RetCode.SERVER_ERROR) if not files: