diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-02-20 16:12:06 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-02-20 16:12:06 -0800 |
commit | c4e3398505aaa188777051c2d5e839b79c53c3e2 (patch) | |
tree | 0731210b7f615d7fe29b4099abf37927edb32a17 /lib | |
parent | 99f1f32340d023616182e03c7e477b80611190d3 (diff) | |
download | chef-c4e3398505aaa188777051c2d5e839b79c53c3e2.tar.gz |
fix ruby 2.7 URI.unescape deprecation
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/http/http_request.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/package/cab.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/msu.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/windows.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/ftp.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/local_file.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/sftp.rb | 4 | ||||
-rw-r--r-- | lib/chef/resource/apt_repository.rb | 2 |
8 files changed, 11 insertions, 11 deletions
diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb index 566d05fa84..406cd2df81 100644 --- a/lib/chef/http/http_request.rb +++ b/lib/chef/http/http_request.rb @@ -176,8 +176,8 @@ class Chef @http_request.body = request_body if request_body && @http_request.request_body_permitted? # Optionally handle HTTP Basic Authentication if url.user - user = URI.unescape(url.user) - password = URI.unescape(url.password) if url.password + user = CGI.unescape(url.user) + password = CGI.unescape(url.password) if url.password @http_request.basic_auth(user, password) end diff --git a/lib/chef/provider/package/cab.rb b/lib/chef/provider/package/cab.rb index 9ccc373dd1..edfcf71fb6 100644 --- a/lib/chef/provider/package/cab.rb +++ b/lib/chef/provider/package/cab.rb @@ -58,7 +58,7 @@ class Chef def default_download_cache_path uri = ::URI.parse(new_resource.source) - filename = ::File.basename(::URI.unescape(uri.path)) + filename = ::File.basename(::CGI.unescape(uri.path)) file_cache_dir = Chef::FileCache.create_cache_path("package/") Chef::Util::PathHelper.cleanpath("#{file_cache_dir}/#{filename}") end diff --git a/lib/chef/provider/package/msu.rb b/lib/chef/provider/package/msu.rb index a00b3f3471..de44ac553f 100644 --- a/lib/chef/provider/package/msu.rb +++ b/lib/chef/provider/package/msu.rb @@ -99,7 +99,7 @@ class Chef def default_download_cache_path uri = ::URI.parse(new_resource.source) - filename = ::File.basename(::URI.unescape(uri.path)) + filename = ::File.basename(::CGI.unescape(uri.path)) file_cache_dir = Chef::FileCache.create_cache_path("package/") Chef::Util::PathHelper.cleanpath("#{file_cache_dir}/#{filename}") end diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb index d21c6576b6..0bad69f9b7 100644 --- a/lib/chef/provider/package/windows.rb +++ b/lib/chef/provider/package/windows.rb @@ -277,7 +277,7 @@ class Chef def default_download_cache_path uri = ::URI.parse(new_resource.source) - filename = ::File.basename(::URI.unescape(uri.path)) + filename = ::File.basename(::CGI.unescape(uri.path)) file_cache_dir = Chef::FileCache.create_cache_path("package/") Chef::Util::PathHelper.cleanpath("#{file_cache_dir}/#{filename}") end diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb index eafebc9693..f4beb2f597 100644 --- a/lib/chef/provider/remote_file/ftp.rb +++ b/lib/chef/provider/remote_file/ftp.rb @@ -57,7 +57,7 @@ class Chef def user if uri.userinfo - URI.unescape(uri.user) + CGI.unescape(uri.user) else "anonymous" end @@ -65,7 +65,7 @@ class Chef def pass if uri.userinfo - URI.unescape(uri.password) + CGI.unescape(uri.password) else nil end diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb index f76c475b1e..92961947f8 100644 --- a/lib/chef/provider/remote_file/local_file.rb +++ b/lib/chef/provider/remote_file/local_file.rb @@ -40,7 +40,7 @@ class Chef def source_path @source_path ||= begin - path = URI.unescape(uri.path) + path = CGI.unescape(uri.path) ChefUtils.windows? ? fix_windows_path(path) : path end end diff --git a/lib/chef/provider/remote_file/sftp.rb b/lib/chef/provider/remote_file/sftp.rb index 3da49ebedd..2f02ac8ee6 100644 --- a/lib/chef/provider/remote_file/sftp.rb +++ b/lib/chef/provider/remote_file/sftp.rb @@ -47,7 +47,7 @@ class Chef end def user - URI.unescape(uri.user) + CGI.unescape(uri.user) end def fetch @@ -62,7 +62,7 @@ class Chef end def pass - URI.unescape(uri.password) + CGI.unescape(uri.password) end def validate_path! diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb index ed29de0652..5f1ed76e21 100644 --- a/lib/chef/resource/apt_repository.rb +++ b/lib/chef/resource/apt_repository.rb @@ -378,7 +378,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 = URI.escape(uri) + uri = CGI.escape(uri) components = Array(components).join(" ") options = [] options << "arch=#{arch}" if arch |