Skip to content

Commit

Permalink
Fixing multiple PRODID lines
Browse files Browse the repository at this point in the history
  • Loading branch information
anufrievroman committed Mar 9, 2023
1 parent 5d93bca commit 83b81c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion calcure/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def create_config_file(self):
"color_active_pane": "2",
"color_separator": "7",
"color_calendar_border": "7",
"color_ics_calendars": "2,3,1,7",
"color_ics_calendars": "2,3,1,7,4,5,2,3,1,7",
"color_background": "-1",
}

Expand Down
10 changes: 6 additions & 4 deletions calcure/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,16 @@ class LoaderICS:

def read_lines(self, file):
"""Read the file line-by-line and remove multiple PRODID lines"""
previous_line = ""
already_has_prodid = False
text = ""
for line in file:
# If there is more than one PRODID line or a TZUNTIL line, skip them:
if (not ("PRODID:" in line and "PRODID:" in previous_line) and
not ("TZUNTIL" in line)):
if ((not (already_has_prodid and "PRODID:" in line)) and
(not "TZUNTIL" in line)):
text += line
previous_line = line

if "PRODID:" in line:
already_has_prodid = True
return text

def read_file(self, path):
Expand Down

0 comments on commit 83b81c0

Please sign in to comment.