diff options
| author | Anton Bobov <abobov@gmail.com> | 2020-11-15 23:45:12 +0500 |
|---|---|---|
| committer | Anton Bobov <abobov@gmail.com> | 2020-11-15 23:45:12 +0500 |
| commit | 592e478bc82660651e45c384817e694ca750f5ab (patch) | |
| tree | 639f913798a23e44f36f1f6e09181378248049e9 /rem2ics | |
| parent | d82d30d806f49cebccc102693b194d598f0d2c38 (diff) | |
Fix rem2ics escaping of summary text.
Diffstat (limited to 'rem2ics')
| -rwxr-xr-x | rem2ics | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -7,12 +7,19 @@ # https://tools.ietf.org/html/rfc5545 import datetime import json +import re import sys from datetime import datetime, timedelta, timezone from os.path import basename, splitext +def escape_text(text): + # https://tools.ietf.org/html/rfc5545#section-3.3.11 + return re.sub(r'[\\;:,]', r'\\\g<0>', text) + + class Event: + def __init__(self, uid, event_json): self.event_json = event_json self.uid = uid @@ -24,7 +31,7 @@ class Event: summary = summary.split(' ', 1)[1] if 'passthru' in e and 'COLOR' in e['passthru']: summary = ' '.join(summary.split(' ')[3:]) - return summary + return escape_text(summary) def categories(self): filename = basename(self.event_json['filename'].upper()) |
