Do not do an extra HEAD request after a PUT for Last-Modified

Use the Date header from a PUT request as the Last-Modified time that we
store in Redis
This commit is contained in:
Greg Karékinian
2018-07-18 19:37:05 +02:00
parent 15ff64ea9e
commit d05cd4a760
2 changed files with 8 additions and 14 deletions

View File

@@ -22,12 +22,10 @@ module RemoteStorage
"PUT", url, md5, content_type
).merge({ "Content-Type" => content_type, "Content-Md5" => md5 })
res = RestClient.put(url, data, authorization_headers)
# S3 does not return a Last-Modified response header on PUTs
head_res = do_head_request(url)
return [
res.headers[:etag].delete('"'),
timestamp_for(head_res.headers[:last_modified])
timestamp_for(res.headers[:date]) # S3 does not return a Last-Modified response header on PUTs
]
end
end