From 8f08c036c44a8986014e93f73fbcc5ab48d92920 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Wed, 7 Sep 2022 12:53:25 +1200 Subject: [PATCH] Replace URI.decode as obsolete, and removed in Ruby 3.0 Replace with URI.decode_www_form_component which has been available since Ruby 1.9 --- lib/fog/aws/parsers/iam/get_group_policy.rb | 2 +- lib/fog/aws/parsers/iam/get_role_policy.rb | 2 +- lib/fog/aws/parsers/iam/get_user_policy.rb | 2 +- lib/fog/aws/parsers/iam/policy_version.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fog/aws/parsers/iam/get_group_policy.rb b/lib/fog/aws/parsers/iam/get_group_policy.rb index 5c8ca9946..f139fa5c5 100644 --- a/lib/fog/aws/parsers/iam/get_group_policy.rb +++ b/lib/fog/aws/parsers/iam/get_group_policy.rb @@ -14,7 +14,7 @@ module Fog when 'GroupName', 'PolicyName' @response[name] = value when 'PolicyDocument' - @response['Policy'][name] = if decoded_string = URI.decode(value) + @response['Policy'][name] = if decoded_string = URI.decode_www_form_component(value) Fog::JSON.decode(decoded_string) rescue value else value diff --git a/lib/fog/aws/parsers/iam/get_role_policy.rb b/lib/fog/aws/parsers/iam/get_role_policy.rb index 124cc467c..88efd19ed 100644 --- a/lib/fog/aws/parsers/iam/get_role_policy.rb +++ b/lib/fog/aws/parsers/iam/get_role_policy.rb @@ -12,7 +12,7 @@ module Fog when 'RoleName', 'PolicyName' @response['Policy'][name] = value when 'PolicyDocument' - @response['Policy'][name] = if decoded_string = URI.decode(value) + @response['Policy'][name] = if decoded_string = URI.decode_www_form_component(value) Fog::JSON.decode(decoded_string) rescue value else value diff --git a/lib/fog/aws/parsers/iam/get_user_policy.rb b/lib/fog/aws/parsers/iam/get_user_policy.rb index af26e7b4a..8aaa1fd77 100644 --- a/lib/fog/aws/parsers/iam/get_user_policy.rb +++ b/lib/fog/aws/parsers/iam/get_user_policy.rb @@ -14,7 +14,7 @@ module Fog when 'UserName', 'PolicyName' @response['Policy'][name] = value when 'PolicyDocument' - @response['Policy'][name] = if decoded_string = URI.decode(value) + @response['Policy'][name] = if decoded_string = URI.decode_www_form_component(value) Fog::JSON.decode(decoded_string) rescue value else value diff --git a/lib/fog/aws/parsers/iam/policy_version.rb b/lib/fog/aws/parsers/iam/policy_version.rb index 1a974f51f..fecdbb01e 100644 --- a/lib/fog/aws/parsers/iam/policy_version.rb +++ b/lib/fog/aws/parsers/iam/policy_version.rb @@ -18,7 +18,7 @@ module Fog when 'IsDefaultVersion' @version[name] = (value == 'true') when 'Document' - @version[name] = if decoded_string = URI.decode(value) + @version[name] = if decoded_string = URI.decode_www_form_component(value) Fog::JSON.decode(decoded_string) rescue value else value