From 5b0a8916ea5a7c565aaf27964bf19a8f3bf5f558 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 2 Jun 2012 14:34:11 +0200 Subject: Fix asset tags for files with more than one dot After the fix done in 39f9f02a, there are cases that will not work correctly. If you have file with "2 extensions", like foo.min.js and you reference the file without extension, like: javascript_include_tag "foo.min" it will fail because sprockets finds foo.min.js with foo.min argument. This commit fixes this case and will get the right file even when referrencing it without extension. (closes #6598) --- actionpack/lib/sprockets/helpers/rails_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/sprockets') diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb index 8ac137b4b5..37c37604d5 100644 --- a/actionpack/lib/sprockets/helpers/rails_helper.rb +++ b/actionpack/lib/sprockets/helpers/rails_helper.rb @@ -157,7 +157,9 @@ module Sprockets def rewrite_extension(source, dir, ext) source_ext = File.extname(source) if ext && source_ext != ".#{ext}" - if !source_ext.empty? && asset_environment[source] + asset = asset_environment[source] + if !source_ext.empty? && asset && + asset.pathname.to_s =~ /#{source}\Z/ source else "#{source}.#{ext}" -- cgit v1.2.3