Don't raise an error if URL contains a colon (#5889)
Merge pull request 5889
This commit is contained in:
parent
e7a7215095
commit
a4c4388b8d
|
@ -35,15 +35,8 @@ module Jekyll
|
|||
# The generated relative URL of the resource
|
||||
#
|
||||
# Returns the String URL
|
||||
# Raises a Jekyll::Errors::InvalidURLError if the relative URL contains a colon
|
||||
def to_s
|
||||
sanitized_url = sanitize_url(generated_permalink || generated_url)
|
||||
if sanitized_url.include?(":")
|
||||
raise Jekyll::Errors::InvalidURLError,
|
||||
"The URL #{sanitized_url} is invalid because it contains a colon."
|
||||
else
|
||||
sanitized_url
|
||||
end
|
||||
sanitize_url(generated_permalink || generated_url)
|
||||
end
|
||||
|
||||
# Generates a URL from the permalink
|
||||
|
|
|
@ -61,16 +61,6 @@ class TestURL < JekyllUnitTest
|
|||
).to_s
|
||||
end
|
||||
|
||||
should "throw an exception if the URL contains a colon" do
|
||||
url = URL.new(
|
||||
:template => "/:x/:y/:z",
|
||||
:placeholders => { :x => "foo", :z => "bar" }
|
||||
)
|
||||
assert_raises Jekyll::Errors::InvalidURLError do
|
||||
url.to_s
|
||||
end
|
||||
end
|
||||
|
||||
should "check for key without trailing underscore" do
|
||||
_, matching_doc = fixture_document("_methods/configuration.md")
|
||||
assert_equal "/methods/configuration-configuration_methods_configuration", URL.new(
|
||||
|
|
Loading…
Reference in New Issue