Navigation Menu

Skip to content

Commit

Permalink
Fix typo and use #get_header to handle mixed-case header keys
Browse files Browse the repository at this point in the history
  • Loading branch information
rbarazi committed Jan 9, 2013
1 parent 44e9491 commit 2371a4c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/fog/aws/models/storage/files.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2371a4c

Please sign in to comment.