mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-02 16:45:08 +08:00
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:
@ -87,6 +87,7 @@ async def upload():
|
|||||||
|
|
||||||
err, files = await asyncio.to_thread(FileService.upload_document, kb, file_objs, current_user.id)
|
err, files = await asyncio.to_thread(FileService.upload_document, kb, file_objs, current_user.id)
|
||||||
if err:
|
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)
|
return get_json_result(data=files, message="\n".join(err), code=RetCode.SERVER_ERROR)
|
||||||
|
|
||||||
if not files:
|
if not files:
|
||||||
|
|||||||
Reference in New Issue
Block a user