mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
934ff8a993
URI.escape doesn't encode question marks properly, CGI.escape doesn't encode spaces properly. So we create an escape class method for Fog::Rackspace that does the CGI.escape methods, only encoding spaces as %20. This makes things work properly with Rackspace Cloud Files.
29 lines
870 B
Ruby
29 lines
870 B
Ruby
module Fog
|
|
module Storage
|
|
class Rackspace
|
|
class Real
|
|
|
|
# Create a new object
|
|
#
|
|
# ==== Parameters
|
|
# * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
|
# * object<~String> - Name for object
|
|
# * data<~String|File> - data to upload
|
|
# * options<~Hash> - config headers for object. Defaults to {}.
|
|
#
|
|
def put_object(container, object, data, options = {})
|
|
data = Fog::Storage.parse_data(data)
|
|
headers = data[:headers].merge!(options)
|
|
request(
|
|
:body => data[:body],
|
|
:expects => 201,
|
|
:headers => headers,
|
|
:method => 'PUT',
|
|
:path => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}"
|
|
)
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|