Skip to content

Commit

Permalink
feat: return file instead of bytes in response
Browse files Browse the repository at this point in the history
  • Loading branch information
Sujanadh committed Sep 9, 2024
1 parent acec316 commit bb4a801
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,13 @@ async def validate_form(form: UploadFile):
# open bytes again to avoid I/O error on closed bytes
form_data = BytesIO(updated_file_bytes.getvalue())

await central_crud.read_and_test_xform(
updated_file_bytes, file_ext
)
await central_crud.read_and_test_xform(updated_file_bytes, file_ext)

# Return the updated form as a StreamingResponse
return StreamingResponse(
form_data,
media_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
headers={"Content-Disposition": f"attachment; filename={form.filename}"}
form_data,
media_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
headers={"Content-Disposition": f"attachment; filename={form.filename}"},
)


Expand Down

0 comments on commit bb4a801

Please sign in to comment.