Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Ruby 3 - URI.escape #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

charlie-prezzano
Copy link

in Ruby 3, URI escape is no longer supported, a simple fix is CGI escape

in Ruby 3, URI escape is no longer supported, a simple fix is CGI escape
@charlie-prezzano
Copy link
Author

Not sure if i will find other issues ... but came across this as I upgraded to Ruby 3 (Rails 6.1.1), from Ruby 2.7 (Rails 5.2)

URI.escape is no longer supported. In my search I found that CGI.escape is a substitute; source: https://ruby-doc.org/stdlib-2.4.1/libdoc/uri/rdoc/URI/Escape.html

As this gem has not been updated in ~6 years ... I forked it and made the one line change. This is my first time doing anything like this and unsure if I am doing this the right way, but it is working.

gem 'madmimi', :git => 'https://github.com/charlie-prezzano/madmimi-gem/'

@marcheiligers
Copy link
Member

Thanks, Charlie. I will check it out today.

@marcheiligers
Copy link
Member

"Today" == 10.days.from_now 😄

A couple of things I discovered:

CGI.escape !== URI.escape

2.7.0 :003 > URI.escape('foo bar')
(irb):3: warning: URI.escape is obsolete
 => "foo%20bar"
2.7.0 :004 > CGI.escape('foo bar')
 => "foo+bar"

This means that the specs on this branch fail.

Before even being able to run the specs I needed to update the safe_yaml and json gems.

Do you want to fix these? Or I can see if I can find some time in the next couple of weeks to handle them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants