Skip to content

Commit

Permalink
only escape str with len>1
Browse files Browse the repository at this point in the history
  • Loading branch information
dvmartinweigl committed Nov 5, 2023
1 parent 5d2ab42 commit 39b1291
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions visyn_core/xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def _json2xlsx():
bold = Font(bold=True)

def _escape(v):
if isinstance(v, str) and v and v[0] in ["+", "-", "@", "="]:
_log.warning("CSV injection detected: %s", v)
if isinstance(v, str) and v and v[0] in ["+", "-", "@", "="] and len(v) > 1:
_log.warning("Escaping possible CSV injection: %s", v)
return f"'{v}"
return v

Expand Down

0 comments on commit 39b1291

Please sign in to comment.