mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added Content-Disposition attribute for Rackspace file
This commit is contained in:
parent
77105e0a6f
commit
41376837f3
2 changed files with 13 additions and 1 deletions
|
@ -19,6 +19,8 @@ module Fog
|
|||
# @see http://www.iana.org/assignments/media-types
|
||||
attribute :content_type, :aliases => ['content_type', 'Content-Type']
|
||||
|
||||
attribute :content_disposition, :aliases => 'Content-Disposition'
|
||||
|
||||
# @!attribute [rw] etag
|
||||
# The MD5 checksum of file. If included file creation request, will ensure integrity of the file.
|
||||
# @return [String] MD5 checksum of file.
|
||||
|
@ -170,6 +172,7 @@ module Fog
|
|||
options['Content-Type'] = content_type if content_type
|
||||
options['Access-Control-Allow-Origin'] = access_control_allow_origin if access_control_allow_origin
|
||||
options['Origin'] = origin if origin
|
||||
options['Content-Disposition'] = content_disposition if content_disposition
|
||||
options.merge!(metadata.to_headers)
|
||||
|
||||
data = service.put_object(directory.key, key, body, options)
|
||||
|
|
|
@ -2,8 +2,12 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do
|
|||
|
||||
pending if Fog.mocking?
|
||||
|
||||
def object_attributes(file=@instance)
|
||||
@instance.service.head_object(@directory.key, file.key).headers
|
||||
end
|
||||
|
||||
def object_meta_attributes(file=@instance)
|
||||
@instance.service.head_object(@directory.key, file.key).headers.reject {|k, v| !(k =~ /X-Object-Meta-/)}
|
||||
object_attributes(file).reject {|k, v| !(k =~ /X-Object-Meta-/)}
|
||||
end
|
||||
|
||||
def clear_metadata
|
||||
|
@ -85,6 +89,11 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do
|
|||
@file = @directory.files.create :key => 'meta-test', :body => lorem_file, :metadata => {:works => true }
|
||||
object_meta_attributes(@file)["X-Object-Meta-Works"]
|
||||
end
|
||||
|
||||
tests("sets Content-Disposition on create").returns("ho-ho-ho") do
|
||||
@file = @directory.files.create :key => 'meta-test', :body => lorem_file, :content_disposition => 'ho-ho-ho'
|
||||
object_attributes(@file)["Content-Disposition"]
|
||||
end
|
||||
ensure
|
||||
@file.destroy if @file
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue