Skip to content
Browse files

Eliminate unnecessary File.exist? when correct file extension given [#…

…1879 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information...
1 parent 06182ea commit 7aa847fab4da41bfa30fa356fc0d7d79b7081734 @pixeltrix pixeltrix committed with josh
Showing with 2 additions and 1 deletion.
  1. +2 −1 actionpack/lib/action_view/helpers/asset_tag_helper.rb
View
3 actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -516,7 +516,8 @@ def self.cache_asset_timestamps=(value)
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

0 comments on commit 7aa847f

Please sign in to comment.
Something went wrong with that request. Please try again.