Skip to content

Commit

Permalink
fix: add escape special xml characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Павел Золотов committed Oct 5, 2023
1 parent 1af63d5 commit 86d7379
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aioxlsxstream/aioxlsxstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import asynczipstream
import typing as t
from dataclasses import dataclass
from xml.sax.saxutils import escape

TEMPLATE_DIR = f"{os.path.dirname(__file__)}/xlsx_template"

Expand Down Expand Up @@ -76,6 +77,7 @@ async def __sheet_data_generator(self, data):
yield start_row_template.format(row=row_number).encode("utf-8")
column_number = 0
async for cell in row:
cell = escape(str(cell)) if cell is not None else ""
yield cell_template.format(
column=column_number_to_name(column_number),
row=row_number,
Expand Down

0 comments on commit 86d7379

Please sign in to comment.