lib/fog/storage/google_json/utils.rb in fog-google-1.20.0 vs lib/fog/storage/google_json/utils.rb in fog-google-1.21.0

- old
+ new

@@ -1,5 +1,7 @@ +require 'addressable' + module Fog module Storage class GoogleJSON module Utils def http_url(params, expires) @@ -17,13 +19,10 @@ private def host_path_query(params, expires) params[:headers]["Date"] = expires.to_i - # implementation from CGI.escape, but without ' ' to '+' conversion - params[:path] = params[:path].b.gsub(/([^a-zA-Z0-9_.\-~]+)/) { |m| - '%' + m.unpack('H2' * m.bytesize).join('%').upcase - }.gsub("%2F", "/") + params[:path] = ::Addressable::URI.encode_component(params[:path], ::Addressable::URI::CharacterClasses::PATH) query = [] if params[:query] filtered = params[:query].reject { |k, v| k.nil? || v.nil? }