pimutils / pimutils/khal

birthdays: .vcf Version 2.x not supported

Open
#1,370 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.1k
Forks
233
Avg merge
1h 44m
Merged PRs (30d)
1

Description

Describe the bug
I have a birthdays calendar set up. On startup I get a lot of warning messages on some .vcf files, all of them being version 2.1

If applicable: Stack Trace

Unknown exception happened.
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/icalendar/parser.py", line 237, in from_ical
    key, val = q_split(param, '=', maxsplit=1)
    ^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/icalendar/parser.py", line 344, in parts
    params = Parameters.from_ical(st[name_split + 1: value_split],
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/icalendar/parser.py", line 261, in from_ical
    raise ValueError(
ValueError: 'CELL' is not a valid parameter string: not enough values to unpack (expected 2, got 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/khal/khalendar/khalendar.py", line 398, in _update_vevent
    update(event.raw, href=href, etag=etag, calendar=calendar)
  File "/usr/lib/python3.12/site-packages/khal/khalendar/backend.py", line 273, in update_vcf_dates
    ical = cal_from_ics(vevent_str)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/khal/icalendar.py", line 539, in cal_from_ics
    cal = icalendar.Calendar.from_ical(ics)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/icalendar/cal.py", line 331, in from_ical
    name, params, vals = line.parts()
                         ^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/icalendar/parser.py", line 353, in parts
    raise ValueError(
ValueError: Content line could not be parsed into parts: 'TEL;CELL:0123 456789': 'CELL' is not a valid parameter string: not enough values to unpack (expected 2, got 1)
warning: Skipping birthdays/896e6a13d4101af400deb141455aaaaa.vcf: Content line could not be parsed into parts: 'TEL;CELL:0123 45689': 'CELL' is not a valid parameter string: not enough values to unpack (expected 2, got 1)
warning: This event will not be available in khal.

To Reproduce

  • set up a birthday calendar
  • add a VCard to the card directory that looks like this:
BEGIN:VCARD
VERSION:2.1
N:Mustermann;Max;;;
FN:Max Mustermann
TEL;CELL:0123 456789
UID:896e6a13d4101af400deb141455aaaaa
END:VCARD

Obviously the line TEL;CELL:0123 456789 makes the parser fail. It is correct 2.1 format. In Version 3.x it should look like this: TEL;TYPE=cell:0123 456789

Expected behavior
Actually I don't expect version 2.1 to be supported, since it is pretty old. I for one am going to convert my old vCards to a newer format.

But I think the restriction vCard-Version >= 3.x should be reflected in the documentation (I am sorry if its is and I missed it)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the documentation covering birthday calendars and accepted vCard versions. Reproduce the warning with the provided VERSION:2.1 example, then document the supported version restriction and the expected TEL syntax or conversion guidance. Done means users can find this requirement before importing older vCards.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.