Last active
December 4, 2017 08:54
-
-
Save lengarvey/c1d17913f9ea95fd999c to your computer and use it in GitHub Desktop.
URI.parse issue with ruby-trunk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| irb(main):014:0* url = "https://bugs.ruby-lang.org/projects/ruby-trunk/issues?set_filter=1&f[]=status_id&op[status_id]=o" | |
| => "https://bugs.ruby-lang.org/projects/ruby-trunk/issues?set_filter=1&f[]=status_id&op[status_id]=o" | |
| irb(main):015:0> URI.encode url | |
| => "https://bugs.ruby-lang.org/projects/ruby-trunk/issues?set_filter=1&f[]=status_id&op[status_id]=o" | |
| irb(main):016:0> URI.parse url | |
| URI::InvalidURIError: bad URI(is not URI?): https://bugs.ruby-lang.org/projects/ruby-trunk/issues?set_filter=1&f[]=status_id&op[status_id]=o | |
| from /Users/artega/.rubies/ruby-trunk/lib/ruby/2.2.0/uri/rfc3986_parser.rb:47:in `split' | |
| from /Users/artega/.rubies/ruby-trunk/lib/ruby/2.2.0/uri/rfc3986_parser.rb:53:in `parse' | |
| from /Users/artega/.rubies/ruby-trunk/lib/ruby/2.2.0/uri/common.rb:223:in `parse' | |
| from (irb):16 | |
| from /Users/artega/.rubies/ruby-trunk/bin/irb:11:in `<main>' |
URI::RFC3896_Parser doesn't implement #escape so there isn't a straightforward solution.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is caused by
URI.parseusing the newURI::RFC3896_ParserbutURI.encodeuses the oldURI::RFC2396_Parser.