Skip to content
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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/jekyll/errors.rb
Expand Up @@ -12,6 +12,5 @@ module Errors
InvalidDateError = Class.new(FatalException)
InvalidPostNameError = Class.new(FatalException)
PostURLError = Class.new(FatalException)
InvalidURLError = Class.new(FatalException)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, reverted the removal.

end
9 changes: 1 addition & 8 deletions lib/jekyll/url.rb
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions test/test_url.rb
Expand Up @@ -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(
Expand Down