From f1f4e84a7ef88d941f6508673bb448de640d6f77 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 14 Aug 2008 12:23:29 -0700 Subject: Fix asset file paths with dangling queries in mtime check --- actionpack/lib/action_view/helpers/asset_tag_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index c2b4f51c9c..623ed1e8df 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -612,7 +612,7 @@ module ActionView end def join_asset_file_contents(paths) - paths.collect { |path| File.read(File.join(ASSETS_DIR, path.split("?").first)) }.join("\n\n") + paths.collect { |path| File.read(asset_file_path(path)) }.join("\n\n") end def write_asset_file_contents(joined_asset_path, asset_paths) @@ -621,10 +621,14 @@ module ActionView # Set mtime to the latest of the combined files to allow for # consistent ETag without a shared filesystem. - mt = asset_paths.map { |p| File.mtime(File.join(ASSETS_DIR, p)) }.max + mt = asset_paths.map { |p| File.mtime(asset_file_path(p)) }.max File.utime(mt, mt, joined_asset_path) end + def asset_file_path(path) + File.join(ASSETS_DIR, path.split('?').first) + end + def collect_asset_files(*path) dir = path.first -- cgit v1.2.3