0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/app/views/users/bookmarks.ics.erb
Bannon Tanner f5203dfcca
FIX: Preserve URI delimiters in ICS URL properties, removing TEXT escaping (#42107)
## Summary

Correctly emit `URL` properties in ICS export without RFC 5545 TEXT
escaping by introducing `IcalEncoder.encode_uri`, which decodes HTML
entities, strips CR/LF characters, and leaves valid URI delimiters such
as commas and semicolons intact. This change is applied to both the
Discourse Events calendar feed and the user bookmarks ICS feed; all
textual properties (`SUMMARY`, `LOCATION`, `DESCRIPTION`) continue to
use the existing TEXT encoder.

## Source

- Patch Triage: https://patch.discourse.org/patch-triage/1547

Co-authored-by: discourse-patch-triage
<272280883+discourse-patch-triage[bot]@users.noreply.github.com>
2026-07-28 14:53:16 -05:00

16 lines
725 B
Text
Vendored

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Discourse//<%= Discourse.current_hostname %>//<%= Discourse.full_version %>//EN
X-WR-CALNAME:<%= IcalEncoder.encode(@calendar_name) %>
<% @bookmark_reminders.each do |bookmark| %>
BEGIN:VEVENT
UID:bookmark_reminder_#<%= bookmark.id %>@<%= Discourse.current_hostname %>
DTSTAMP:<%= bookmark.updated_at.strftime(I18n.t("datetime_formats.formats.calendar_ics")) %>
DTSTART:<%= bookmark.reminder_at_ics_start %>
DTEND:<%= bookmark.reminder_at_ics_end %>
SUMMARY:<%= IcalEncoder.encode(bookmark.name.presence || bookmark.title) %>
DESCRIPTION:<%= IcalEncoder.encode(bookmark.bookmarkable_url) %>
URL:<%= IcalEncoder.encode_uri(bookmark.bookmarkable_url) %>
END:VEVENT
<% end %>
END:VCALENDAR