lib/google/cloud/storage/file/signer_v4.rb in google-cloud-storage-1.19.0 vs lib/google/cloud/storage/file/signer_v4.rb in google-cloud-storage-1.20.0
- old
+ new
@@ -120,12 +120,13 @@
end
def canonical_and_signed_headers headers
# Headers needs to be in alpha order.
canonical_headers = headers || {}
- canonical_headers = Hash[canonical_headers.map do |k, v|
- [k.downcase, v.strip.gsub(/\s+/, " ")]
- end]
+ headers_arr = canonical_headers.map do |k, v|
+ [k.downcase, v.strip.gsub(/[^\S\t]+/, " ").gsub(/\t+/, "\t")]
+ end
+ canonical_headers = Hash[headers_arr]
canonical_headers["host"] = "storage.googleapis.com"
canonical_headers = canonical_headers.sort_by do |k, _|
k.downcase
end.to_h