New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't raise an error if URL contains a colon #5889

Merged
merged 2 commits into from Mar 31, 2017
Jump to file or symbol
Failed to load files and symbols.
+1 −19
Diff settings

Always

Just for now

View
@@ -12,6 +12,5 @@ module Errors
InvalidDateError = Class.new(FatalException)
InvalidPostNameError = Class.new(FatalException)
PostURLError = Class.new(FatalException)
InvalidURLError = Class.new(FatalException)

This comment has been minimized.

@pathawks

pathawks Feb 17, 2017

Member

Let's not get rid of this error; we might want to use it elsewhere.

@pathawks

pathawks Feb 17, 2017

Member

Let's not get rid of this error; we might want to use it elsewhere.

This comment has been minimized.

@DirtyF

DirtyF Feb 17, 2017

Member

OK, reverted the removal.

@DirtyF

DirtyF Feb 17, 2017

Member

OK, reverted the removal.

end
end
View
@@ -35,15 +35,8 @@ def initialize(options)
# 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
View
@@ -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

This comment has been minimized.

@parkr

parkr Feb 17, 2017

Member

What do you and @pathawks think about, if a placeholder doesn't exist, simply removing it?

The real issue we're driving at is: you used an invalid URL placeholder, i.e. :dat instead of :date.

@parkr

parkr Feb 17, 2017

Member

What do you and @pathawks think about, if a placeholder doesn't exist, simply removing it?

The real issue we're driving at is: you used an invalid URL placeholder, i.e. :dat instead of :date.

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(
ProTip! Use n and p to navigate between commits in a pull request.