From 14e06bd7ba8dd9ef02dad76853dffef44773eb8a Mon Sep 17 00:00:00 2001 From: iSecloud <869820505@qq.com> Date: Mon, 18 Nov 2024 16:34:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E4=BF=AE=E5=A4=8D=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8D=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20#8018?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/backend/utils/excel.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbm-ui/backend/utils/excel.py b/dbm-ui/backend/utils/excel.py index 55e6990126..9a3a5393d2 100644 --- a/dbm-ui/backend/utils/excel.py +++ b/dbm-ui/backend/utils/excel.py @@ -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 @@ -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