insanum / gcalcli

Google Calendar Command Line Interface
MIT License
3.31k stars 311 forks source link

Importing a .vcs with no events crashes gcalcli #668

Closed Rijaja closed 1 week ago

Rijaja commented 1 year ago

Example empty .vcs:

BEGIN:VCALENDAR
PRODID: Gpu2vcs modified by Dynamisoft
VERSION:2.0
METHOD:PUBLISH
END:VCALENDAR

Output after trying to import this file:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.11/site-packages/vobject/base.py", line 527, in __getattr__
    return self.contents[toVName(name, 5)]
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'vevent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/bin/gcalcli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/.local/lib/python3.11/site-packages/gcalcli/cli.py", line 231, in main
    gcal.ImportICS(
  File "/home/user/.local/lib/python3.11/site-packages/gcalcli/gcal.py", line 1594, in ImportICS
    for ve in v.vevent_list:
              ^^^^^^^^^^^^^
  File "/home/user/.local/lib/python3.11/site-packages/vobject/base.py", line 531, in __getattr__
    raise AttributeError(name)
AttributeError: vevent_list

I'm guessing this is because the file doesn't contain a "BEGIN:VEVENT" line.