Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6752 from steveklabnik/fix_5680

Respect absolute paths in compute_source_path.
  • Loading branch information...
commit 52d09638dfc07413956846a6319b145511a15757 1 parent a8e22ae
@rafaelfranca rafaelfranca authored
View
8 actionpack/lib/action_view/asset_paths.rb
@@ -33,7 +33,13 @@ def compute_public_path(source, dir, options = {})
# Return the filesystem path for the source
def compute_source_path(source, dir, ext)
source = rewrite_extension(source, dir, ext) if ext
- File.join(config.assets_dir, dir, source)
+
+ sources = []
+ sources << config.assets_dir
+ sources << dir unless source[0] == ?/
+ sources << source
+
+ File.join(sources)
end
def is_uri?(path)
View
3  actionpack/test/fixtures/public/foo/baz.css
@@ -0,0 +1,3 @@
+body {
+background: #000;
+}
View
14 actionpack/test/template/asset_tag_helper_test.rb
@@ -1055,9 +1055,6 @@ def test_caching_stylesheet_link_tag_with_named_paths_and_relative_url_root_when
assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
end
-
-
-
def test_caching_stylesheet_include_tag_when_caching_off
ENV["RAILS_ASSET_ID"] = ""
config.perform_caching = false
@@ -1086,6 +1083,17 @@ def test_caching_stylesheet_include_tag_when_caching_off
assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
end
+
+ def test_caching_stylesheet_include_tag_with_absolute_uri
+ ENV["RAILS_ASSET_ID"] = ""
+
+ assert_dom_equal(
+ %(<link href="/stylesheets/all.css" media="screen" rel="stylesheet" />),
+ stylesheet_link_tag("/foo/baz", :cache => true)
+ )
+
+ FileUtils.rm(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
+ end
end
class AssetTagHelperNonVhostTest < ActionView::TestCase
Please sign in to comment.
Something went wrong with that request. Please try again.