Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[SOLVED] Event Calendar ics trouble in SS 2.4


Go to End


5 Posts   1622 Views

Avatar
3dgoo

Community Member, 135 Posts

29 August 2011 at 4:59pm

Hello,

I've noticed .ics files do not work properly on Silverstripe 2.4.x for me. The ics files download, but the browser seems to treat them as html files. And when a calendar program tries to open the file it does not import the calendar event at all.

This is even happening on the event calendar demo for me:
http://eventcalendar.bluehousegroup.com/basic-calendar/

My sites with Silverstripe 2.3.x do not have this issue.
Is anyone else having this issue?

Cheers

Avatar
UncleCheese

Forum Moderator, 4102 Posts

31 August 2011 at 5:50am

I think it depends on your browser. For me, those ICS files download to iCal in Safari, but an older browser like IE may not know what to do with that content type.

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
3dgoo

Community Member, 135 Posts

31 August 2011 at 11:14am

I'm testing in Firefox 6, Chrome 13, IE9. I don't know which browser my client is using, but they are having the same issue.

The weird thing is on 2.3 installs the ics files work fine, but on 2.4 installs the ics files aren't recognised as ical data. The contents of the files are the same in each.

Avatar
Fremmedkar

Community Member, 1 Post

19 September 2011 at 6:51pm

SilverStripe seems to override the content-type of headers that are not set by SilverStripe's own header functions. Adding the following line to the top of your ics action in the Calendar_Controller class of Calendar.php should give you the correct header:

$this->getResponse()->addHeader('Content-Type', 'text/calendar');

The same goes for the new ical action and the rss action, but with "text/xml" or "application/rss+xml" as the content type for rss.

Avatar
3dgoo

Community Member, 135 Posts

20 September 2011 at 3:19pm

Wow. Thank you very much. That worked perfectly.

Cheers