Handle invalid URLs in rewriter. Fixed #1638
This commit is contained in:
parent
658b28c337
commit
d3a5494062
3 changed files with 17 additions and 17 deletions
|
@ -179,16 +179,10 @@ Feature: Assets get file hashes appended to them and references to them are upda
|
||||||
| javascripts/application-1d8d5276.js |
|
| javascripts/application-1d8d5276.js |
|
||||||
| stylesheets/site-7474cadd.css |
|
| stylesheets/site-7474cadd.css |
|
||||||
|
|
||||||
# @wip Currently broken, we should move all asset-host functionality out of Compass and into something more similar to asset_hash with Rack-based rewrites
|
Scenario: Already minified files should still be hashed
|
||||||
# Scenario: Enabling an asset host and referencing assets in CSS with URL fragments are rewritten correctly
|
Given a successfully built app at "asset-hash-minified-app"
|
||||||
# Given a successfully built app at "asset-hash-host-app"
|
When I cd to "build"
|
||||||
# When I cd to "build"
|
Then the following files should exist:
|
||||||
|
| javascripts/jquery.min-276c87ff.js |
|
||||||
# Then the following files should exist:
|
And the following files should not exist:
|
||||||
# | images/100px-5fd6fb90.jpg |
|
| javascripts/jquery.min.js |
|
||||||
# | stylesheets/fragment-c058ecb2.css |
|
|
||||||
# And the following files should not exist:
|
|
||||||
# | images/100px.jpg |
|
|
||||||
|
|
||||||
# And the file "stylesheets/fragment-c058ecb2.css" should contain "http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"
|
|
||||||
# And the file "stylesheets/fragment-c058ecb2.css" should not contain "http://middlemanapp.com/images/100px.jpg#test"
|
|
||||||
|
|
1
middleman-core/fixtures/asset-hash-minified-app
Submodule
1
middleman-core/fixtures/asset-hash-minified-app
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit a8bd04e58affa118f8af7f1c363ee96ad6086b48
|
|
@ -336,12 +336,17 @@ module Middleman
|
||||||
opening_character = $1
|
opening_character = $1
|
||||||
asset_path = $2
|
asset_path = $2
|
||||||
|
|
||||||
|
begin
|
||||||
uri = ::Addressable::URI.parse(asset_path)
|
uri = ::Addressable::URI.parse(asset_path)
|
||||||
|
|
||||||
if uri.relative? && uri.host.nil? && (result = yield(asset_path))
|
if uri.relative? && uri.host.nil? && (result = yield(asset_path))
|
||||||
"#{opening_character}#{result}"
|
"#{opening_character}#{result}"
|
||||||
else
|
else
|
||||||
match
|
match
|
||||||
end
|
end
|
||||||
|
rescue ::Addressable::URI::InvalidURIError
|
||||||
|
match
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue