This project is archived and is in readonly mode.
action caching sets wrong content-type when :cache_path is a string
-
Michael Koziarski
- Milestone cleared.
- Assigned user set to Michael Koziarski
-
Christoph Petschnig
This bug occurs also with a Proc object that returns a string.
The gist-url with the patch was deleted, so I post an easy workaround for this bug. Simply set the content type yourself somewhere inside the macro, like:
caches_action :index, :if => Proc.new { |c| result = c.cache_me?; c.headers["Content-Type"] = 'text/xml; charset=UTF-8' if result; result },
:cache_path => Proc.new { |c| File.join('abc', c.some_method) } -
Mislav
Aw damn, I've been cleaning up my gists and deleted the patch because I thought it was applied. If anyone needs it back, shout now. I was pretty sure this was fixed soon after this was reported.
Christoph, can you make a failing test for your case?
-
Christoph Petschnig
Ok, I made the failing tests.
I choose to attach a whole rails project instead of a single file. Please look at docs/README for some explanation.
I am not an experienced tests writer, yet it seems to me, that I found two other bugs while writing the tests. Please look at the comments in test/functional/xml_caching_controller_test.rb therefore.
I would like to investigate that a little further, but I will be buzy for the next seven days.
-
Mislav
- Tag changed from caches_action, format, patch to bug, caches_action, caching, format, patch
Here's the revised patch with failing tests for both cases: string key or proc that returns a string.
-
Repository
- State changed from new to resolved
(from [fa45540cdb30cee44983c9121e3ebfc317d21668]) Ensure correct content type is declared after cache hits on actions with string cache keys [#1585 action caching sets wrong content-type when :cache_path is a string state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
