From e889e1eee17148bd8ba982b89c016f9de62d6094 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 5 Feb 2009 00:33:23 +0000 Subject: [PATCH] Eliminate unnecessary File.exist? when correct file extension given --- .../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 f6abea3..a32beb6 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 -- 1.5.4.5