CakeResponse is missing ICalendar and not responding as documented
Reported by euromark | February 11th, 2012 @ 07:55 AM | in 2.0.7 (closed)
What I did
I was wondering why CakeResponse is not working for specific extensions (like ics, ical) whereas pdf etc work perfect.
What happened
The controller does recognize the extension ('ext'=>'ics')
but nothing of the file serving process gets triggered.
Seems like
a) none of the iCalender extensions are in the $_mimeTypes list
'ics' => 'text/calendar',
@see http://de.wikipedia.org/wiki/ICalendar
b) even if it is an unknown extension it should trigger the
process - searching the template in the /extension/ subfolder as
well as including the /Layouts/extension/default.ctp. After all, we
whitelisted the extensions in Router::parseExtensions('ics',
...);
It should then silently fall back to "application/octet-stream"
etc.
And the documentation for Router::parseExtensions() states the expected behavior:
* The file extension itself is made available in the controller as
* $this->params['url']['ext'], and is used by the RequestHandler component to
* automatically switch to alternate layouts and templates, and load helpers
* corresponding to the given content, i.e. RssHelper.
Or does not state that unknown file extensions cannot be handled automatically.
Comments and changes to this ticket
-

Mark Story February 11th, 2012 @ 09:20 AM
- → Assigned user set to Mark Story
- → Milestone set to 2.0.7
- → Tag set to cakeresponse, defect, ical
I can add ics as a known mimetype. The layout switching isn't handled by Router though. Its handled by the RequestHandlerComponent which states:
- If the extension is of a type that RequestHandler understands, it will set that Content-type in the response header.
Which is inline with the current behavior. I'll update the docs on Router to reference RequestHandler as well though, as that's probably not as clear as it could be.
-
euromark February 11th, 2012 @ 09:36 AM
I see.
So if I understand you correctly we need to inform the RequestHandler soon enough about cake-unknown file extensions and their mimetype so it can correctly route it as a file-serving content?which has to be prior to RequestHandlerComponent ::startup()
-

Mark Story February 11th, 2012 @ 10:27 AM
Yes, like in a beforeFilter(). I'm pretty sure this is in the docs, and if not I can add it so people have an example to work from.
-

CakePHP February 11th, 2012 @ 10:45 AM
- → State changed from new to resolved
(from [4c01ba7224ab9609a644d8b331b8346e4d5fc4c9]) Add ics mime type.
Fixes #2565
https://github.com/cakephp/cakephp/commit/4c01ba7224ab9609a644d8b33...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
Repository is at http://github.com/cakephp/cakephp
Creating a bug report
When creating a bug report, please include as much relevant information as possible. Please include code to reproduce the issue. Or even better, make a unit test. Either change an existing test or add a new test to show that the expected behavior is not occuring.