1
This commit is contained in:
@@ -370,10 +370,13 @@ async def export_team_credit_records(
|
|||||||
])
|
])
|
||||||
|
|
||||||
from starlette.responses import StreamingResponse
|
from starlette.responses import StreamingResponse
|
||||||
|
from urllib.parse import quote
|
||||||
output.seek(0)
|
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(
|
return StreamingResponse(
|
||||||
iter([output.getvalue()]),
|
iter([output.getvalue()]),
|
||||||
media_type="text/csv; charset=utf-8-sig",
|
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}"},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user