diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-02-21 13:32:39 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-02-21 13:32:39 -0800 |
commit | 1b02cfc8bcdb9569917eb954f2b59f686026cd9f (patch) | |
tree | 8d8c6e2613136255be0f4d15713e17823cdea1ee | |
parent | 6362d9fa1b6967c2971992df00eecbb8ae3ae9ca (diff) | |
download | chef-1b02cfc8bcdb9569917eb954f2b59f686026cd9f.tar.gz |
Properly fix encoding of the entire URI by using Addressable
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/resource/apt_repository.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb index 31f34596ac..902c026c57 100644 --- a/lib/chef/resource/apt_repository.rb +++ b/lib/chef/resource/apt_repository.rb @@ -19,7 +19,7 @@ require_relative "../resource" require_relative "../http/simple" require "tmpdir" unless defined?(Dir.mktmpdir) -require "cgi" unless defined?(CGI) +require "addressable" unless defined?(Addressable) class Chef class Resource @@ -379,7 +379,7 @@ class Chef def build_repo(uri, distribution, components, trusted, arch, add_src = false) uri = make_ppa_url(uri) if is_ppa_url?(uri) - uri = CGI.escape(uri) + uri = Addressable::URI.parse(uri) components = Array(components).join(" ") options = [] options << "arch=#{arch}" if arch @@ -387,7 +387,7 @@ class Chef optstr = unless options.empty? "[" + options.join(" ") + "]" end - info = [ optstr, uri, distribution, components ].compact.join(" ") + info = [ optstr, uri.normalize.to_s, distribution, components ].compact.join(" ") repo = "deb #{info}\n" repo << "deb-src #{info}\n" if add_src repo |