Skip to content

Commit

Permalink
export_ratings: enforce encoding in csv export
Browse files Browse the repository at this point in the history
  • Loading branch information
em92 committed Dec 16, 2023
1 parent dc566b9 commit 4846572
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion qllr/blueprints/export_rating/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def get_document(self, request: Request, con: Connection) -> Response:
resp.headers["Content-Disposition"] = (
"attachment; filename=" + request.path_params["gametype"] + "_ratings.csv"
)
resp.headers["Content-Type"] = "text/csv"
resp.headers["Content-Type"] = "text/csv; charset=UTF-8"
return resp


Expand Down
2 changes: 1 addition & 1 deletion tests/samples/exported_ratings_ad.csv
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Niko_;22.66286277770996;1;http://qlstats.net/player/76561198908919769
*AD*DARKY;22.406667709350586;2;http://qlstats.net/player/76561198257684581
MajinTakenaga;22.388601303100586;1;http://qlstats.net/player/76561198256969692
pandima;22.388601303100586;1;http://qlstats.net/player/76561198257864860
Étɳ;22.264556884765625;2;http://qlstats.net/player/76561198041660726
Étɳ;22.264556884765625;2;http://qlstats.net/player/76561198041660726
Ofelia;22.229782104492188;2;http://qlstats.net/player/76561198273108270
dobo shire;21.829530715942383;6;http://qlstats.net/player/76561198043212328
Pappy;21.537921905517578;4;http://qlstats.net/player/76561198030939512
Expand Down
1 change: 1 addition & 0 deletions tests/test_export_ratings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_ratings_ad_redirect_bad_format(service):

def test_ratings_ad_csv(service):
resp = service.get("/export_rating/ad.csv")
assert resp.encoding == "utf-8"
assert resp.text == read_sample("exported_ratings_ad.csv")


Expand Down

0 comments on commit 4846572

Please sign in to comment.