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)
This commit is contained in:
lys1313013
2026-01-20 12:24:54 +08:00
committed by GitHub
parent f367189703
commit 120648ac81

View File

@ -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: