aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-11-03 10:52:50 -0400
committerJosé Valim <jose.valim@gmail.com>2010-11-11 17:27:47 +0100
commit793967cd404c839c1af8b3ef847dc1725a1fb7c6 (patch)
tree3f7997585d63a442f498f9f34c62385858a32471 /actionpack/lib
parent154e5d735efcc840c3be52a19b1f8a89eeb2e9e9 (diff)
downloadrails-793967cd404c839c1af8b3ef847dc1725a1fb7c6.tar.gz
rails-793967cd404c839c1af8b3ef847dc1725a1fb7c6.tar.bz2
rails-793967cd404c839c1af8b3ef847dc1725a1fb7c6.zip
provide better error message if path is uri [#5914 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index a728fde748..db5f5f301a 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -878,7 +878,7 @@ module ActionView
end
def join_asset_file_contents(paths)
- paths.collect { |path| File.read(asset_file_path!(path)) }.join("\n\n")
+ paths.collect { |path| File.read(asset_file_path!(path, true)) }.join("\n\n")
end
def write_asset_file_contents(joined_asset_path, asset_paths)
@@ -896,8 +896,10 @@ module ActionView
File.join(config.assets_dir, path.split('?').first)
end
- def asset_file_path!(path)
- unless is_uri?(path)
+ def asset_file_path!(path, error_if_file_is_uri = false)
+ if is_uri?(path)
+ raise(Errno::ENOENT, "Asset file #{path} is uri and cannot be merged into single file") if error_if_file_is_uri
+ else
absolute_path = asset_file_path(path)
raise(Errno::ENOENT, "Asset file not found at '#{absolute_path}'" ) unless File.exist?(absolute_path)
return absolute_path