only encode if current path is broken
This commit is contained in:
parent
4ffaa9dde5
commit
51ccfe1143
|
@ -157,12 +157,16 @@ module Middleman
|
|||
end
|
||||
|
||||
# Try to parse URL
|
||||
begin
|
||||
uri = URI(url)
|
||||
rescue ::URI::InvalidURIError
|
||||
begin
|
||||
uri = URI(::URI.encode(url))
|
||||
rescue ::URI::InvalidURIError
|
||||
# Nothing we can do with it, it's not really a URI
|
||||
return url
|
||||
end
|
||||
end
|
||||
|
||||
relative = options[:relative]
|
||||
raise "Can't use the relative option with an external URL" if relative && uri.host
|
||||
|
|
Loading…
Reference in a new issue