diff --git a/middleman-core/features/asset_host.feature b/middleman-core/features/asset_host.feature index bcd4c06c..47ef143e 100644 --- a/middleman-core/features/asset_host.feature +++ b/middleman-core/features/asset_host.feature @@ -11,6 +11,7 @@ Feature: Alternate between multiple asset hosts Then I should see 'src="https://code.jquery.com/jquery-2.1.3.min.js"' Then I should see content matching %r{http://assets1.example.com/} Then I should not see content matching %r{http://assets1.example.com//} + Then I should see content matching %r{'//www.example.com/script.js'} When I go to "/stylesheets/asset_host.css" Then I should see content matching %r{http://assets1.example.com/} Then I should not see content matching %r{http://assets1.example.com//} @@ -28,6 +29,7 @@ Feature: Alternate between multiple asset hosts Then I should see 'src="https://code.jquery.com/jquery-2.1.3.min.js"' Then I should see content matching %r{http://assets1.example.com/} Then I should not see content matching %r{http://assets1.example.com//} + Then I should see content matching %r{'//www.example.com/script.js'} When I go to "/stylesheets/asset_host.css" Then I should see content matching %r{http://assets1.example.com/} - Then I should not see content matching %r{http://assets1.example.com//} \ No newline at end of file + Then I should not see content matching %r{http://assets1.example.com//} diff --git a/middleman-core/fixtures/asset-host-app/source/asset_host.html.erb b/middleman-core/fixtures/asset-host-app/source/asset_host.html.erb index 41490760..a528d275 100755 --- a/middleman-core/fixtures/asset-host-app/source/asset_host.html.erb +++ b/middleman-core/fixtures/asset-host-app/source/asset_host.html.erb @@ -39,4 +39,6 @@ <%= image_tag "blank1031.gif" %> <%= image_tag "blank1032.gif" %> <%= image_tag "blank1033.gif" %> -<%= image_tag "blank1034.gif" %> \ No newline at end of file +<%= image_tag "blank1034.gif" %> + + diff --git a/middleman-core/lib/middleman-core/util.rb b/middleman-core/lib/middleman-core/util.rb index b27633e3..b06593f0 100644 --- a/middleman-core/lib/middleman-core/util.rb +++ b/middleman-core/lib/middleman-core/util.rb @@ -333,7 +333,7 @@ module Middleman asset_path = $2 uri = ::Addressable::URI.parse(asset_path) - if uri.relative? && result = yield(asset_path) + if uri.relative? && uri.host.nil? && (result = yield(asset_path)) "#{opening_character}#{result}" else match