tmatilai / vagrant-proxyconf

Vagrant plugin that configures the virtual machine to use proxies
MIT License
531 stars 74 forks source link

Wanted ruby3.0 on Ubuntu 22.04 LTS support #241

Open ihatomorio opened 2 years ago

ihatomorio commented 2 years ago

Hello,

I using this plugin on Ubuntu 22.04 LTS. While I using this plugin, it fails with this message.

/root/.vagrant.d/gems/3.0.2/gems/vagrant-proxyconf-2.0.10/lib/vagrant-proxyconf/userinfo_uri.rb:35:in `user': undefined method `decode' for URI:Module (NoMethodError)
(snip: sorry, I prohibited copy-pasting from my working terminal.)

Ruby 3.0 not supporting URI.decode method. So please use URI.decode_www_form method. I couldn't send PR with my permissions, so I describe diff below.

diff --git a/lib/vagrant-proxyconf/userinfo_uri.rb b/lib/vagrant-proxyconf/userinfo_uri.rb
index 456c454..5f2e357 100644
--- a/lib/vagrant-proxyconf/userinfo_uri.rb
+++ b/lib/vagrant-proxyconf/userinfo_uri.rb
@@ -32,13 +32,13 @@ module VagrantPlugins

       # @return [String] the username
       def user
-        return URI.decode(@uri.user) if @uri.user
+        return URI.decode_www_form(@uri.user) if @uri.user
         @uri.user
       end

       # @return [String] the password
       def pass
-        return URI.decode(@uri.password) if @uri.password
+        return URI.decode_www_form(@uri.password) if @uri.password
         @uri.password
       end

Could it fix it? Thanks.