From b5ea3a91c30fd7b87d5676e2154abdeac0b367cc Mon Sep 17 00:00:00 2001 From: Chris Salvato Date: Wed, 13 Apr 2022 11:38:14 -0600 Subject: [PATCH] Changes escape method to support ruby 3 --- lib/clever-ruby/api_client.rb | 2 +- lib/clever-ruby/configuration.rb | 2 +- override/api_client.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/clever-ruby/api_client.rb b/lib/clever-ruby/api_client.rb index 93d5916a..78085e26 100644 --- a/lib/clever-ruby/api_client.rb +++ b/lib/clever-ruby/api_client.rb @@ -289,7 +289,7 @@ def sanitize_filename(filename) def build_request_url(path) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') - URI.encode(@config.base_url + path) + Addressable::URI.parse(@config.base_url + path).normalize.to_s end # Builds the HTTP request body diff --git a/lib/clever-ruby/configuration.rb b/lib/clever-ruby/configuration.rb index 0dfed50c..3e35dc98 100644 --- a/lib/clever-ruby/configuration.rb +++ b/lib/clever-ruby/configuration.rb @@ -175,7 +175,7 @@ def base_path=(base_path) def base_url url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') - URI.encode(url) + Addressable::URI.parse(url).normalize.to_s end # Gets API key (with prefix if set). diff --git a/override/api_client.rb b/override/api_client.rb index 93d5916a..78085e26 100644 --- a/override/api_client.rb +++ b/override/api_client.rb @@ -289,7 +289,7 @@ def sanitize_filename(filename) def build_request_url(path) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') - URI.encode(@config.base_url + path) + Addressable::URI.parse(@config.base_url + path).normalize.to_s end # Builds the HTTP request body