1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[ninefold|storage] allow overwriting files for consistency

This commit is contained in:
geemus 2011-11-01 09:35:51 -05:00
parent e41aab3cc2
commit 89f5a07c71

View file

@ -73,13 +73,15 @@ module Fog
options[:headers] ||= {}
options[:headers]['Content-Type'] = content_type if content_type
options[:body] = body
if objectid
# pre-existing file, do a PUT
data = connection.put_namespace(ns, options)
else
# new file, POST
begin
data = connection.post_namespace(ns, options)
self.objectid = data.headers['location'].split('/')[-1]
rescue => error
if error.message =~ /The resource you are trying to create already exists./
data = connection.put_namespace(ns, options)
else
raise error
end
end
# merge_attributes(data.headers)
true