Open TrueRou opened 1 month ago
Ah we recently had this problem on Akatsuki. The issue is the content-disposition header in HTTP only supports latin-1 content, however osu! beatmap song names may contain unicode characters.
We fixed it here: https://github.com/osuAkatsuki/score-service/commit/fa116d81466ab76ad9d074212faf65dfb866b15e
This aligns replay names with those from bancho.
If anyone would be interested in taking a crack at this, it should be pretty straightforward!
Hi @TrueRou , can i start working on this ? i have go through the api.py file and controller "api_get_replay" so username may contain unicode characters, you want to implement something like this ?
f"attachment; filename*=utf-8''{quote(username)} - ".encode('latin-1')
Describe the bug
Function
api_get_replay
may fail to response in some cases about the bad naming format in the header. We found that it always occurred when the username has characters that were not from ASCII charsets.Exception:
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 22-23: ordinal not in range(256)
Stacktrace:
To Reproduce
/get_replay
.Expected behavior
bancho.py Version
5.2.2
Python Version
3.11.X (Default)
Relevant log output
No response
Additional context
No response