aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-08-14 12:23:29 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-08-14 12:28:02 -0700
commitf1f4e84a7ef88d941f6508673bb448de640d6f77 (patch)
tree26549476ba44de26fbad378f69680d83ed451ae5 /actionpack/lib
parent8cb14ee1203c9ed380c4b192e8730757a52d43cb (diff)
downloadrails-f1f4e84a7ef88d941f6508673bb448de640d6f77.tar.gz
rails-f1f4e84a7ef88d941f6508673bb448de640d6f77.tar.bz2
rails-f1f4e84a7ef88d941f6508673bb448de640d6f77.zip
Fix asset file paths with dangling queries in mtime check
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb8
1 files changed, 6 insertions, 2 deletions
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