This project is archived and is in readonly mode.
Asset caching does not work with relative_url_root
-
Martin Rehfeld
- Tag changed from actionpack, bug, helper to actionpack, bug, helper, patch
A possible fix could be to add variants of
compute_javascript_pathsandcompute_stylesheet_pathsto explictly handle paths for the local filesystem which in turn callcompute_public_pathwith a new optional boolean parameter that will allow suppressing the insertion of relative_url_root into the source path.My shot at it is attached -- it makes the tests pass again and does not seem to brake anything else.
-
Martin Rehfeld
It's probably a good idea to update the cache key in compute_public_path to include new optional parameter
filesystem_pathas well. Find an additional patch attached. -
Martin Rehfeld
- Assigned user set to josh
- Tag changed from actionpack, bug, helper, patch to 2.1, actionpack, bug, helper, patch
Any opinion on extending the cache key or the suggested solution in general?
-
josh
- Milestone cleared.
- State changed from new to open
- Tag changed from 2.1, actionpack, bug, helper, patch to actionpack, bug, patch
-
josh
Would this work as well?
source else source = "/#{dir}/#{source}" unless source[0] == ?/ - if has_request + if has_request && include_host unless source =~ %r{^#{ActionController::Base.relative_url_root}/} source = "#{ActionController::Base.relative_url_root}#{source}" end -
Martin Rehfeld
- Tag changed from actionpack, bug, patch to actionpack, bug, patch, tiny
Good catch! This seems to be the shortest possible fix one could imagine. I can confirm that both the newly introduced tests are passing and the fix also works with a real-life app. Updated patches are attached (rebased to current master while we're at it).
+1 from my side.
-
Repository
- State changed from open to resolved
(from [10380a22a65d93bee6775a0ffe93071b798bf249]) Fixed AssetTag cache with with relative_url_root [#1022 Asset caching does not work with relative_url_root state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
