URLs are Case Sensitive and are processed incorrectly by Canonical Rails
Closed this issue · 8 comments
My URL is https://www.neueve.com/content/6/S2/S7 however Canonical Rails is outputting the canonical version as https://www.neueve.com/content/6/s2/s7.
This is incorrect, and URLs are case sensitive.
The bug is the "downcase" on line 32 of tag_helper.rb:
raw "#{canonical_protocol}#{host}#{port}#{path_without_html_extension}#{trailing_slash_if_needed}#{whitelisted_query_string}".downcase
Please delete the .downcase thanks!
Having just run into this I'd be happy to open a PR but I'm not sure what you mean by the second part about guarding against incorrectly cased inbound links... How would it know if the link was incorrectly cased and what would it do about it? An incorrectly cased link is presumably going to lead to a 404 from rails anyway?
I agree with Tom. For instance for this page, the correct URL is:
https://github.com/jumph4x/canonical-rails/issues/53
When you go to:
https://github.com/jumph4x/canonical-rails/issueS/53
,
or:
https://github.com/juMph4x/canoNical-rails/isSues/53
the result is a 404 as expected.
However https://github.com/juMph4x/canoNical-rails/issues/53
does work. My proposed edit is to simply delete the ".downcase" on that one line.
I see your point.