Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[AWS Storage] Fix typo and use #get_header to handle mixed-case header keys #1456

Merged
merged 1 commit into from

2 participants

@rbarazi

Changes:

  • normalise_headers => normalize_headers
  • Use get_header to be case insensitive when retrieving headers (Etag vs ETag)
@geemus geemus merged commit c755bed into fog:master
@alanthing alanthing referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/fog/aws/models/storage/files.rb
View
10 lib/fog/aws/models/storage/files.rb
@@ -61,11 +61,11 @@ def each
def get(key, options = {}, &block)
requires :directory
data = service.get_object(directory.key, key, options, &block)
+ normalize_headers(data)
file_data = data.headers.merge({
:body => data.body,
:key => key
})
- normalise_headers(file_data)
new(file_data)
rescue Excon::Errors::NotFound => error
case error.message
@@ -96,10 +96,10 @@ def get_https_url(key, expires, options = {})
def head(key, options = {})
requires :directory
data = service.head_object(directory.key, key, options)
+ normalize_headers(data)
file_data = data.headers.merge({
:key => key
})
- normalise_headers(file_data)
new(file_data)
rescue Excon::Errors::NotFound
nil
@@ -110,9 +110,9 @@ def new(attributes = {})
super({ :directory => directory }.merge!(attributes))
end
- def normalise_headers(headers)
- headers['Last-Modified'] = Time.parse(headers['Last-Modified'])
- headers['ETag'].gsub!('"','')
+ def normalize_headers(data)
+ data.headers['Last-Modified'] = Time.parse(data.get_header('Last-Modified'))
+ data.headers['ETag'] = data.get_header('ETag').gsub('"','')
end
end
Something went wrong with that request. Please try again.