Add specific check for TLD-like strings when replacing inline urls. Fixes #1751
This commit is contained in:
parent
be2788b6ca
commit
a47b2138f8
|
@ -8,6 +8,7 @@ Feature: Alternate between multiple asset hosts
|
|||
"""
|
||||
And the Server is running
|
||||
When I go to "/asset_host.html"
|
||||
Then I should see "'.google-analytics.com/ga.js'"
|
||||
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//}
|
||||
|
|
|
@ -44,3 +44,12 @@
|
|||
<a href="https://github.com/angular/angular.js">Angular.js</a>
|
||||
|
||||
<script>(function(a,b,c,d){})(window,document,'script','//www.example.com/script.js');</script>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') +
|
||||
'.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
|
|
|
@ -349,7 +349,7 @@ module Middleman
|
|||
begin
|
||||
uri = ::Addressable::URI.parse(asset_path)
|
||||
|
||||
if uri.relative? && uri.host.nil? && (result = yield asset_path)
|
||||
if uri.relative? && uri.host.nil? && !asset_path.match(/^[^\/].*[a-z]+\.[a-z]+\/.*/) && (result = yield(asset_path))
|
||||
"#{opening_character}#{result}"
|
||||
else
|
||||
match
|
||||
|
|
Loading…
Reference in a new issue