absolute_url should not mangle URL if called more than once (#5789)
Merge pull request 5789
This commit is contained in:
parent
f46dffcc8e
commit
768d2bb5a3
|
@ -10,6 +10,7 @@ module Jekyll
|
|||
# Returns the absolute URL as a String.
|
||||
def absolute_url(input)
|
||||
return if input.nil?
|
||||
return input if Addressable::URI.parse(input).absolute?
|
||||
site = @context.registers[:site]
|
||||
return relative_url(input).to_s if site.config["url"].nil?
|
||||
Addressable::URI.parse(site.config["url"] + relative_url(input)).normalize.to_s
|
||||
|
|
|
@ -402,6 +402,11 @@ class TestFilters < JekyllUnitTest
|
|||
})
|
||||
assert_equal "http://xn--mlaut-jva.example.org/", filter.absolute_url(page_url)
|
||||
end
|
||||
|
||||
should "not modify an absolute URL" do
|
||||
page_url = "http://example.com/"
|
||||
assert_equal "http://example.com/", @filter.absolute_url(page_url)
|
||||
end
|
||||
end
|
||||
|
||||
context "relative_url filter" do
|
||||
|
|
Loading…
Reference in New Issue