Skip to content

Commit a1a92a8

Browse files
authored
fix: Excel export prohibits inputting external links or formulas (#3106)
1 parent 5e0d804 commit a1a92a8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

apps/dataset/serializers/document_serializers.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,10 +661,9 @@ def get_workbook(data_dict, document_dict):
661661
cell = worksheet.cell(row=row_idx + 1, column=col_idx + 1)
662662
if isinstance(col, str):
663663
col = re.sub(ILLEGAL_CHARACTERS_RE, '', col)
664-
if col.startswith(('=', '+', '-', '@')):
665-
cell.value = '\ufeff' + col
666-
else:
667-
cell.value = col
664+
if col.startswith(('=', '+', '-', '@')):
665+
col = '\ufeff' + col
666+
cell.value = col
668667
# 创建HttpResponse对象返回Excel文件
669668
return workbook
670669

0 commit comments

Comments
 (0)