From 7469041c59724163a9108b037f0965469282b70c Mon Sep 17 00:00:00 2001 From: Chad Krsek Date: Mon, 25 Apr 2011 21:57:49 -0700 Subject: Revert "asset helpers should understand scheme-relative URLs" This reverts commit 057412ce38ead06307a887dca333837a99f84f22. --- actionpack/lib/action_view/helpers/asset_paths.rb | 11 ++--------- actionpack/test/template/asset_tag_helper_test.rb | 15 --------------- 2 files changed, 2 insertions(+), 24 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/asset_paths.rb b/actionpack/lib/action_view/helpers/asset_paths.rb index 0429e60cd5..55a4c442fd 100644 --- a/actionpack/lib/action_view/helpers/asset_paths.rb +++ b/actionpack/lib/action_view/helpers/asset_paths.rb @@ -12,13 +12,13 @@ module ActionView @controller = controller end - # Add the extension +ext+ if not present. Return full or scheme-relative URLs otherwise untouched. + # Add the extension +ext+ if not present. Return full URLs otherwise untouched. # Prefix with /dir/ if lacking a leading +/+. Account for relative URL # roots. Rewrite the asset path for cache-busting asset ids. Include # asset host, if configured, with the correct request protocol. def compute_public_path(source, dir, ext = nil, include_host = true) source = source.to_s - return source if is_uri?(source) || is_scheme_relative_uri?(source) + return source if is_uri?(source) source = rewrite_extension(source, dir, ext) if ext source = "/#{dir}/#{source}" unless source[0] == ?/ @@ -36,13 +36,6 @@ module ActionView path =~ %r{^[-a-z]+://|^cid:} end - # A URI relative to a base URI's scheme? - # See http://labs.apache.org/webarch/uri/rfc/rfc3986.html#relative-normal - # "//g" => "http://g" - def is_scheme_relative_uri?(path) - path =~ %r{^//} - end - private def rewrite_extension(source, dir, ext) diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 2abc806e97..4a93def5a8 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -66,7 +66,6 @@ class AssetTagHelperTest < ActionView::TestCase %(auto_discovery_link_tag(:xml)) => %(), %(auto_discovery_link_tag(:rss, :action => "feed")) => %(), %(auto_discovery_link_tag(:rss, "http://localhost/feed")) => %(), - %(auto_discovery_link_tag(:rss, "//localhost/feed")) => %(), %(auto_discovery_link_tag(:rss, {:action => "feed"}, {:title => "My RSS"})) => %(), %(auto_discovery_link_tag(:rss, {}, {:title => "My RSS"})) => %(), %(auto_discovery_link_tag(nil, {}, {:type => "text/html"})) => %(), @@ -101,7 +100,6 @@ class AssetTagHelperTest < ActionView::TestCase %(javascript_include_tag("http://example.com/all")) => %(), %(javascript_include_tag("http://example.com/all.js")) => %(), - %(javascript_include_tag("//example.com/all.js")) => %(), } StylePathToTag = { @@ -131,7 +129,6 @@ class AssetTagHelperTest < ActionView::TestCase %(stylesheet_link_tag("http://www.example.com/styles/style")) => %(), %(stylesheet_link_tag("http://www.example.com/styles/style.css")) => %(), - %(stylesheet_link_tag("//www.example.com/styles/style.css")) => %(), } ImagePathToTag = { @@ -160,7 +157,6 @@ class AssetTagHelperTest < ActionView::TestCase %(image_tag("slash..png")) => %(Slash.), %(image_tag(".pdf.png")) => %(.pdf), %(image_tag("http://www.rubyonrails.com/images/rails.png")) => %(Rails), - %(image_tag("//www.rubyonrails.com/images/rails.png")) => %(Rails), %(image_tag("mouse.png", :mouseover => "/images/mouse_over.png")) => %(Mouse), %(image_tag("mouse.png", :mouseover => image_path("mouse_over.png"))) => %(Mouse), %(image_tag("mouse.png", :alt => nil)) => %() @@ -199,7 +195,6 @@ class AssetTagHelperTest < ActionView::TestCase %(video_tag("error.avi", "size" => "100 x 100")) => %(