Skip to content

Commit

Permalink
Eliminate unnecessary File.exist? when correct file extension given [#…
Browse files Browse the repository at this point in the history
…1879 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information
pixeltrix authored and josh committed Feb 5, 2009
1 parent 06182ea commit 7aa847f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion actionpack/lib/action_view/helpers/asset_tag_helper.rb
Expand Up @@ -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

Expand Down

0 comments on commit 7aa847f

Please sign in to comment.