Skip to content

Conversation

ochan1
Copy link
Contributor

@ochan1 ochan1 commented Jan 26, 2025

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

@ochan1 ochan1 changed the title Update URL Rerouting to encode brackets in URI Encoding Update URL Rerouting to encode brackets and escape non-ASCII in URI Encoding Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant