Skip to content

Commit

Permalink
Merge pull request #1537 from willsowerbutts/master
Browse files Browse the repository at this point in the history
Remove unexpected control codes from ICS files
  • Loading branch information
pbiering committed Jul 12, 2024
2 parents fe33d79 + f1d84ce commit bb11278
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions radicale/item/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def read_components(s: str) -> List[vobject.base.Component]:
s = re.sub(r"^(PHOTO(?:;[^:\r\n]*)?;ENCODING=b(?:;[^:\r\n]*)?:)"
r"data:[^;,\r\n]*;base64,", r"\1", s,
flags=re.MULTILINE | re.IGNORECASE)
# Workaround for bug with malformed ICS files containing control codes
# Filter out all control codes except those we expect to find:
# * 0x09 Horizontal Tab
# * 0x0A Line Feed
# * 0x0D Carriage Return
s = re.sub(r'[\x00-\x08\x0B\x0C\x0E-\x1F]', '', s)
return list(vobject.readComponents(s, allowQP=True))


Expand Down

0 comments on commit bb11278

Please sign in to comment.