Skip to content

Commit

Permalink
fix(backend): 修复导出的文件名编码问题 TencentBlueKing#8018
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud authored and xfwduke committed Nov 20, 2024
1 parent c7b61e8 commit 14e06bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dbm-ui/backend/utils/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import openpyxl
from django.http.response import HttpResponse, StreamingHttpResponse
from django.utils.encoding import escape_uri_path
from openpyxl import Workbook
from openpyxl.styles import Alignment, PatternFill
from openpyxl.worksheet.worksheet import Worksheet
Expand Down Expand Up @@ -159,7 +160,7 @@ def response(cls, wb: Workbook, excel_name: str) -> HttpResponse:
content=save_virtual_workbook(wb),
content_type="application/octet-stream",
)
response["Content-Disposition"] = f"attachment;filename={excel_name}"
response["Content-Disposition"] = f"attachment;filename={escape_uri_path(excel_name)}"
response["Access-Control-Expose-Headers"] = "content-disposition"
return response

Expand Down

0 comments on commit 14e06bd

Please sign in to comment.