lochmueller / calendarize

📆 Best TYPO3 Calendar ever 📆
http://typo3.org/extensions/repository/view/calendarize
75 stars 84 forks source link

ICS Import : truncing spaces when new line in description #724

Closed Seranno closed 1 year ago

Seranno commented 1 year ago

The ICS Import trough the Scheduling module has a small issue with the handling of spaces before and after a newline for the description field. The new line chars are filtered ([CR;LF] in Notepad++) : OK. But the spaces are truncated so the 2 words are merged.

Backend

sreenshot2

Frontend

screenshot

Small example of my ICS :

BEGIN:VCALENDAR
PRODID:-//MDaemon Technologies Ltd//MDaemon 21.5.2
VERSION:2.0
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:W. Europe Standard Time
BEGIN:STANDARD
DTSTART:16011005T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:Standard Time
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010305T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
TZNAME:Daylight Savings Time
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:202207292022073020220610112913YK18S5
SEQUENCE:0
DTSTAMP:20220610T093118Z
SUMMARY:Collecte
DESCRIPTION:Lors de la collecte les enregistrements salaires pour le 
 nouveau mois de collecte sont créés. Les listes de salaires sont 
 imprimées sur base des enregistrements salaires existant après la 
 collecte.
LOCATION:CCSS
PRIORITY:5
DTSTART;VALUE=DATE:20220729
DTEND;VALUE=DATE:20220730
TRANSP:OPAQUE
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
END:VEVENT
BEGIN:VEVENT
UID:2022072920220730202206101129134X
DSMD
SEQUENCE:0
DTSTAMP:20220610T093118Z
SUMMARY:Rappels SECUline
DESCRIPTION:Envoi d&apos\;une lettre de rappel que les salaires du mois 
 de collecte courant n&apos\;ont pas encore été déclarés.
LOCATION:CCSS
PRIORITY:5
DTSTART;VALUE=DATE:20220729
DTEND;VALUE=DATE:20220730
TRANSP:OPAQUE
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
END:VEVENT
END:VCALENDAR
okmiim commented 1 year ago

HI @Seranno, Is your installation with or without composer? What calendarize and TYPO3 version are you using?

lochmueller commented 1 year ago

Hey @okmiim , Hey @Seranno

I added a test case for this. First of all, there is a wrong/strange line in the ISC. The "DSMD"-line. I added the ICS to a test file: https://github.com/lochmueller/calendarize/blob/master/Tests/Unit/Ical/ICalEventTest.php#L429 You can checkout the current master and run the test with "composer tool:phpunit:tmp".

Currently, the test has a wrong assertion, so he test is green: https://github.com/lochmueller/calendarize/blob/master/Tests/Unit/Ical/ICalEventTest.php#L487 but the Dissect integration AND the VObject are truncated the spaces.

I don't found the problem in EXT:calendarize in the first view, so I think it is a problem of the source ICS or the using ICS Parser Libs.

Any hints?

Regards, Tim

okmiim commented 1 year ago

@lochmueller The committed test is missing the trailing white spaces from the example (are removed by php-cs-fixer "risky"). Also, the expected string is wrong.

I put up better tests in f918732e77f87c1cfbc8dfb3ef5b73ce7e909214. It only fails for the Dissect (installation without composer):

--- Expected
+++ Actual
@@ @@
-'This is a long description that exists on a long line.'
+'This is a longdescription that exists on a long line.'

The trimming happens here: https://github.com/lochmueller/calendarize/blob/956116f224cfd7e4e635abd947fa4b05d721ebd3/Resources/Private/Php/ICalDissect/src/JMBTechnologyLimited/ICalDissect/ICalParser.php#L46-L52

lochmueller commented 1 year ago

Thanks for the fix :-)

Seranno commented 1 year ago

Wow, that was fast :D Many thanks for the fix ! It worked.