Allow colons in `uri_escape` filter

Fixes #5954
This commit is contained in:
Pat Hawks 2017-03-16 07:54:13 -05:00
parent 0f0ac6f586
commit ec5b45cd7c
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
2 changed files with 6 additions and 1 deletions

View File

@ -152,7 +152,7 @@ module Jekyll
#
# Returns the escaped String.
def uri_escape(input)
Addressable::URI.encode(input)
Addressable::URI.normalize_component(input)
end
# Replace any whitespace in the input string with a single space

View File

@ -317,6 +317,11 @@ class TestFilters < JekyllUnitTest
assert_equal "my%20things", @filter.uri_escape("my things")
end
should "escape colon" do
assert_equal "foo:bar", @filter.uri_escape("foo:bar")
assert_equal "foo%20bar:baz", @filter.uri_escape("foo bar:baz")
end
context "absolute_url filter" do
should "produce an absolute URL from a page URL" do
page_url = "/about/my_favorite_page/"