Fix asset file paths with dangling queries in mtime check

This commit is contained in:
Jeremy Kemper 2008-08-14 12:23:29 -07:00
parent 8cb14ee120
commit f1f4e84a7e
1 changed files with 6 additions and 2 deletions

View File

@ -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