enh: empty file handling behaviour

This commit is contained in:
Timothy J. Baek 2024-10-26 13:05:54 -07:00
parent 25a37baeec
commit e36acd6217
2 changed files with 5 additions and 1 deletions

View File

@ -76,7 +76,7 @@ def upload_file(file: UploadFile = File(...), user=Depends(get_verified_user)):
file_item = FileModelResponse(
**{
**file_item.model_dump(),
"error": e,
"error": str(e.detail) if hasattr(e, "detail") else str(e),
}
)

View File

@ -133,6 +133,10 @@
const uploadedFile = await uploadFile(localStorage.token, file);
if (uploadedFile) {
if (uploadedFile.error) {
toast.warning(uploadedFile.error);
}
fileItem.status = 'uploaded';
fileItem.file = uploadedFile;
fileItem.id = uploadedFile.id;