diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2009-02-05 15:38:29 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-02-05 15:38:29 -0600 |
commit | 7aa847fab4da41bfa30fa356fc0d7d79b7081734 (patch) | |
tree | 79a4aae9194ff0ad751c01a108906d2fbaaeed76 /actionpack/lib/action_view | |
parent | 06182ea02e92afad579998aa80144588e8865ac3 (diff) | |
download | rails-7aa847fab4da41bfa30fa356fc0d7d79b7081734.tar.gz rails-7aa847fab4da41bfa30fa356fc0d7d79b7081734.tar.bz2 rails-7aa847fab4da41bfa30fa356fc0d7d79b7081734.zip |
Eliminate unnecessary File.exist? when correct file extension given [#1879 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index f6abea38ed..a32beb6100 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -516,7 +516,8 @@ module ActionView def compute_public_path(source, dir, ext = nil, include_host = true) has_request = @controller.respond_to?(:request) - if ext && (File.extname(source).blank? || File.exist?(File.join(ASSETS_DIR, dir, "#{source}.#{ext}"))) + source_ext = File.extname(source)[1..-1] + if ext && (source_ext.blank? || (ext != source_ext && File.exist?(File.join(ASSETS_DIR, dir, "#{source}.#{ext}")))) source += ".#{ext}" end |