🐛 Fixed ascii-encoding in headers

This commit is contained in:
Mawoka
2022-12-05 18:19:34 +01:00
parent 1994116410
commit 394887aff6
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ async def export_quiz(quiz_id: uuid.UUID, user: User = Depends(get_current_user)
stream_response(),
media_type="application/octet-stream",
headers={
"Content-Disposition": f"attachment;filename={quiz.title}.cqa"
"Content-Disposition": f"attachment;filename={quiz.title.encode('ascii', errors='ignore').decode()}.cqa"
# noqa: E501
},
)
+1 -1
View File
@@ -270,6 +270,6 @@ async def export_quiz_answers(export_token: str, game_pin: str):
iter_file(),
media_type="application/vnd.ms-excel",
headers={
"Content-Disposition": f"attachment;filename=ClassQuiz-{quiz.title}-{datetime.now().strftime('%m-%d-%Y')}.xlsx" # noqa: E501
"Content-Disposition": f"attachment;filename=ClassQuiz-{quiz.title.encode('ascii', errors='ignore').decode()}-{datetime.now().strftime('%m-%d-%Y')}.xlsx" # noqa: E501
},
)