lfos / calcurse

A text-based calendar and scheduling application
https://calcurse.org
BSD 2-Clause "Simplified" License
991 stars 95 forks source link

Cannot import event with empty description #274

Open GuillaumeAllain opened 4 years ago

GuillaumeAllain commented 4 years ago

-- Version: 4.6.0 (macOS, installed with brew)

-- Description: Cannot import *.ics files with empty description , such as those imported from Google Calendar using calcurse-caldav. This means that most of my events, even those generated in the past with calcurse cannot be reimported since last update.

-- Repro: Here is a .ics file that I cannot import. Those that I export from Calendar.app or Google Calendar are very similar:

  1. Create TEST.ics with the following content:
    
    BEGIN:VCALENDAR
    VERSION:2.0
    PRODID:-//acme//NONSGML remmy v0.1
    METHOD:PUBLISH

BEGIN:VEVENT ORGANIZER:MAILTO:me@machine UID:6D68F3FD-D4D3-11E9-B96B-CAB4B35793DA LOCATION:see description CLASS:PUBLIC RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR DTSTART:20200402T120000 DTEND:20200402T120000 SUMMARY: TEST DESCRIPTION: DTSTAMP:20200402T120000 END:VEVENT

END:VCALENDAR

2. Import into calcurse 
`calcurse -i TEST.ics`

3. Here is the log from the failed import :
+-------------------------------------------------------------------+ Calcurse icalendar import log.
Import from icalendar file
TEST.ics
version 2.0 at 02/04/2020 17:42.
Items which could not be imported are described below.
The log line format is as follows:
TYPE [LINE]: DESCRIPTION
where:
* TYPE is the item type, 'VEVENT' or 'VTODO'
* LINE is the line in the import file where the item begins
* DESCRIPTION explains why the item could not be imported

+-------------------------------------------------------------------+

VEVENT [6]: empty description.

lhca commented 4 years ago

Ha! Previously calcurse detected an empty description and logged the fact as an error, but due a bug - corrected in 4.6.0 - the error condition was ignored and the event accepted.

Although not very meaningful, an empty description is perfectly valid according to the iCalendar standard, so it seems calcurse should accept it. Usually a description will trigger the creation of an attached note containing the description. Should that still be the case? If yes, should the note say, e.g.,

[description is empty]

?

By the way, is the LOCATION contents authentic or your invention?

GuillaumeAllain commented 4 years ago

@lhca No, I just took the *.ics template from #239.

I feel like the note should be empty and trigger an empty note (calcurse should accept an empty description) and keep an empty description when exported, to keep compatibility with google cal. In fact, if I create an event in calcurse and try to grab it from google calendar with calcurse-caldave --init=keep-remote, the item cannot even be imported anymore.

lhca commented 4 years ago

Calcurse never exports a DESCRIPTION, empty or not. Nothing new here.

nmeum commented 4 years ago

On Alpine Linux the ical-009.sh test still fails for me (even with c3165b8da21303747008d74dd3a686d11029989b applied):

$ ./ical-009.sh actual
See /tmp/calcurse_log.MIciDd for details.
2 apps / 0 events / 1 todo / 10 skipped

VEVENT [12]: could not retrieve event start time.
VEVENT [17]: recurrence frequency not recognized.
VEVENT [23]: malformed summary line
VTODO [28]: item priority is invalid (must be between 0 and 9).
VEVENT [32]: malformed exceptions line.
VEVENT [39]: line break in summary.
VEVENT [44]: malformed description line.
VEVENT [50]: malformed description.
VTODO [62]: malformed summary.
VTODO [66]: The ical file seems to be malformed. The end of item was not found.
        1         0         1

And:

$ ./ical-009.sh expected
Import process report: 0068 lines read
2 apps / 0 events / 1 todo / 10 skipped

VEVENT [12]: could not retrieve event start time.
VEVENT [17]: recurrence frequency not recognized.
VEVENT [23]: malformed summary line
VTODO [28]: item priority is invalid (must be between 0 and 9).
VEVENT [32]: malformed exceptions line.
VEVENT [39]: line break in summary.
VEVENT [44]: malformed description line.
VEVENT [50]: malformed description.
VTODO [62]: malformed summary.
VTODO [66]: The ical file seems to be malformed. The end of item was not found.
      1       0       1

The format of the last line is different and the actual output contains a reference to a log file.

lhca commented 4 years ago

Thanks for taking the trouble to report this.

Please note that the calcurse patch in https://github.com/lfos/calcurse/commit/c3165b8da21303747008d74dd3a686d11029989b does work even though the test fails.

The test is too sloppily written (by me). I'll think of something better.

jayghoshter commented 4 years ago

Any progress/update on this issue?

lfos commented 4 years ago

Yes, the test has been fixed in the pu branch.