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
|
@ -336,10 +336,15 @@ module Middleman
|
|||
opening_character = $1
|
||||
asset_path = $2
|
||||
|
||||
uri = ::Addressable::URI.parse(asset_path)
|
||||
if uri.relative? && uri.host.nil? && (result = yield(asset_path))
|
||||
"#{opening_character}#{result}"
|
||||
else
|
||||
begin
|
||||
uri = ::Addressable::URI.parse(asset_path)
|
||||
|
||||
if uri.relative? && uri.host.nil? && (result = yield(asset_path))
|
||||
"#{opening_character}#{result}"
|
||||
else
|
||||
match
|
||||
end
|
||||
rescue ::Addressable::URI::InvalidURIError
|
||||
match
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue