spatie / calendar-links

Generate add to calendar links for Google, iCal and other calendar systems
https://spatie.be/opensource
MIT License
914 stars 148 forks source link

Support description field adding HTML content. #148

Closed dravenk closed 2 years ago

dravenk commented 2 years ago

When adding content using Microsoft calendar, you can add hyperlinks and images in the description field. I'm not sure it can be added in any other way, but if it is supported, need to add it in the test case. https://github.com/spatie/calendar-links/blob/master/tests/TestCase.php

In office.com's case, this line invalidates the HTML code that could otherwise be added (the tag a) to Office.com. Lost HTML code ( tag a, tag img):

$url .= '&body='.urlencode($this->sanitizeText($link->description));

https://github.com/spatie/calendar-links/pull/115/files#diff-52bc3e89d42d67ff8ce6574eae714190994c30e6f602250bab90d03f634f3c6bR40

https://github.com/spatie/calendar-links/blob/master/src/Generators/WebOffice.php#L40

Related: Accented characters lost in Outlook #117

dravenk commented 2 years ago

Adding Test only. PR: https://github.com/spatie/calendar-links/pull/149

dravenk commented 2 years ago

Using rawurlencode instead of urlencode can fix this bug https://github.com/spatie/calendar-links/pull/115. Because the urlencode replace space to + but rawurlencode replace the right characters %20.

dravenk commented 2 years ago

@lptn Please review PR https://github.com/spatie/calendar-links/pull/150