Permalink
Browse files

Fix typo and use #get_header to handle mixed-case header keys

  • Loading branch information...
1 parent 44e9491 commit 2371a4c90018b83d8575095de2a8a11474fdbecc @rbarazi committed Jan 9, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 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

0 comments on commit 2371a4c

Please sign in to comment.