mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|storage] Normalise headers for Files#get/#head
This commit is contained in:
parent
939d95bcfe
commit
bfb9d22ad2
1 changed files with 8 additions and 3 deletions
|
@ -46,9 +46,7 @@ module Fog
|
|||
:body => data.body,
|
||||
:key => key
|
||||
})
|
||||
file_data['Last-Modified'] = Time.parse(file_data['Last-Modified'])
|
||||
file_data['ETag'].gsub!('"','')
|
||||
file_data['Content-Length'] = file_data['Content-Length'].to_i
|
||||
normalise_headers(file_data)
|
||||
new(file_data)
|
||||
rescue Excon::Errors::NotFound
|
||||
nil
|
||||
|
@ -65,6 +63,7 @@ module Fog
|
|||
file_data = data.headers.merge({
|
||||
:key => key
|
||||
})
|
||||
normalise_headers(file_data)
|
||||
new(file_data)
|
||||
rescue Excon::Errors::NotFound
|
||||
nil
|
||||
|
@ -75,6 +74,12 @@ module Fog
|
|||
super({ :directory => directory }.merge!(attributes))
|
||||
end
|
||||
|
||||
def normalise_headers(headers)
|
||||
headers['Last-Modified'] = Time.parse(headers['Last-Modified'])
|
||||
headers['ETag'].gsub!('"','')
|
||||
headers['Content-Length'] = headers['Content-Length'].to_i
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue