Skip to content

Commit

Permalink
fix: encode filename
Browse files Browse the repository at this point in the history
  • Loading branch information
dantetemplar committed Jul 10, 2024
1 parent 765d410 commit 02900a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/moodle/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ async def preview_moodle(course_id: int, module_id: int, filename: str):
if e.code == "NoSuchKey":
return Response(status_code=404)
raise e
encoded_filename = filename.encode("utf-8").decode("unicode-escape")

return StreamingResponse(
response,
media_type="application/octet-stream",
headers={"Content-Disposition": f"inline; filename={filename}"},
headers={"Content-Disposition": f'inline; filename*=UTF-8"{encoded_filename}'},
)


Expand Down

0 comments on commit 02900a9

Please sign in to comment.