Skip to content

Commit 59f6667

Browse files
committed
fix: strip whitespace from document filename in Content-Disposition header
--bug=1065792@tapd-62980211 --user=刘瑞斌 【知识库】文档名中有 / ,导出zip格式会报错 https://www.tapd.cn/62980211/s/1837025
1 parent 39a0f86 commit 59f6667

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

apps/knowledge/serializers/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def export_zip(self, with_valid=True):
601601

602602
workbook = DocumentSerializers.Operate.get_workbook(data_dict, document_dict)
603603
response = HttpResponse(content_type='application/zip')
604-
response['Content-Disposition'] = f'attachment; filename="{document.name}.zip"'
604+
response['Content-Disposition'] = f'attachment; filename="{document.name.strip()}.zip"'
605605
zip_buffer = io.BytesIO()
606606
with TemporaryDirectory() as tempdir:
607607
knowledge_file = os.path.join(tempdir, 'document.xlsx')

0 commit comments

Comments
 (0)