This commit is contained in:
2026-07-06 18:42:48 +08:00
parent c49f93dcd9
commit a3f67a76f8
+5 -2
View File
@@ -370,10 +370,13 @@ async def export_team_credit_records(
])
from starlette.responses import StreamingResponse
from urllib.parse import quote
output.seek(0)
filename = f"团队积分_{team.name}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv"
safe_team_name = team.name or "team"
filename = f"团队积分_{safe_team_name}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv"
encoded_filename = quote(filename)
return StreamingResponse(
iter([output.getvalue()]),
media_type="text/csv; charset=utf-8-sig",
headers={"Content-Disposition": f"attachment; filename*=UTF-8''{filename}"},
headers={"Content-Disposition": f"attachment; filename*=UTF-8''{encoded_filename}"},
)