Update URL Rerouting to encode brackets and escape non-ASCII in URI Encoding #320
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the common error of bracket encoding ignored leading to Bad URI redirect errors, this uses the extra parameters that tells Rails to encode the brackets
https://stackoverflow.com/questions/10814021/ruby-uriinvalidurierror-bad-uriis-not-uri-besides-encoding/10835810
Also fixes recent error after this one to escape non-ASCII from URI
https://stackoverflow.com/questions/46849219/ruby-uriinvalidurierror-uri-must-be-ascii-only
Applied to main URL Redirect link violator, but also on other parts in same file for uniformity
Tested and developed (and patched temporarily) on Production server (don't do this often :P)
Sample Error fixed (for bracket):
An URI::InvalidURIError occurred in #:
bad URI(is not URI?): http://www.hashcollision.org/hkn/python/ahocorasick/[/url]
-------------------------------
Request:
-------------------------------
* URL : https://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/%5B/url%5D
* HTTP Method: GET
Other Sample Error fixed (for non-ASCII):
An ArgumentError occurred in #:
invalid byte sequence in US-ASCII
config/routes.rb:414:in `block (2 levels) in <top (required)>'
-------------------------------
Request:
-------------------------------
* URL : https://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/IDLE-chinese.htm%C2%A0--
* HTTP Method: GET