From d1b74bc2bf389d9ae7e0248bcf3ecb320cec02d4 Mon Sep 17 00:00:00 2001 From: bsag Date: Sun, 23 Jul 2006 06:36:18 +0000 Subject: [PATCH] Notes with returns in them broke the iCal feed. By looking at how iCal itself encodes notes with returns/linebreaks in them, I figured out that you need a one line string with each line break as a literal '\n', which iCal then interprets as a linebreak. iCal now accepts feeds containing notes with linebreaks, and properly interprets those linebreaks. Fixes #319 git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@289 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/helpers/feed_helper.rb | 5 +++++ tracks/app/views/feed/ical.rhtml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tracks/app/helpers/feed_helper.rb b/tracks/app/helpers/feed_helper.rb index b05f056d..345d9fe2 100644 --- a/tracks/app/helpers/feed_helper.rb +++ b/tracks/app/helpers/feed_helper.rb @@ -57,4 +57,9 @@ module FeedHelper return result_string end + def format_ical_notes(notes) + split_notes = notes.split(/\n/) + joined_notes = split_notes.join("\\n") + end + end diff --git a/tracks/app/views/feed/ical.rhtml b/tracks/app/views/feed/ical.rhtml index f3a69dc4..f68001d2 100644 --- a/tracks/app/views/feed/ical.rhtml +++ b/tracks/app/views/feed/ical.rhtml @@ -14,7 +14,7 @@ DTSTAMP:<%= @todo.created_at.strftime("%Y%m%dT%H%M%SZ") %> DTSTART;VALUE=DATE:<%= @todo.created_at.strftime("%Y%m%d") %> SUMMARY:<%= @todo.description %> <% if @todo.notes? -%> -DESCRIPTION:<%= @todo.notes %> +DESCRIPTION:<%= format_ical_notes(@todo.notes) %> <% end -%> <% if @todo.due -%> DUE;VALUE=DATE:<%= @todo.due.strftime("%Y%m%d") %>