webmachine/webmachine-ruby

Can't find drop in replacement for URI.unescape that keeps the specs passing

bethesque opened this issue · 1 comments

Notes for myself and any other interested parties.

Trying to remove the use of URI.unescape as it is deprecated in Ruby 2.7 and gives me screens full of warnings!

The docs here say:

This method is obsolete and should not be used. Instead, use CGI.unescape, URI.decode_www_form or URI.decode_www_form_component depending on your specific use case.

Unfortunately, I can't yet find a non deprecated method that maintains the behaviour of the old method.

See failing test here (I've tried all the replacement methods suggested):

https://travis-ci.org/bethesque/webmachine-ruby/jobs/643681892#L2398

My research ( link to single stackoverflow post that supports my case ) indicates that plus symbols in the path component of a URL should be considered as literals, and only plus signs in the query parameters should be converted to spaces, so the spec failure is correct. We need to find a non-deprecated way of unescaping the %20s and keeping the +s.

See #257