mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws][storage] more robust object url generation, also fixes non-standard regions and defaults to https
This commit is contained in:
parent
a986736523
commit
99d2920372
3 changed files with 10 additions and 9 deletions
|
@ -23,9 +23,9 @@ module Fog
|
||||||
end
|
end
|
||||||
url({
|
url({
|
||||||
:headers => {},
|
:headers => {},
|
||||||
:host => "#{bucket_name}.#{@host}",
|
:host => @host,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => CGI.escape(object_name)
|
:path => [bucket_name, CGI.escape(object_name)].join('/')
|
||||||
}, expires)
|
}, expires)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@ module Fog
|
||||||
end
|
end
|
||||||
url({
|
url({
|
||||||
:headers => {},
|
:headers => {},
|
||||||
:host => "#{bucket_name}.#{@host}",
|
:host => @host,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => CGI.escape(object_name)
|
:path => [bucket_name, CGI.escape(object_name)].join('/')
|
||||||
}, expires)
|
}, expires)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@ module Fog
|
||||||
end
|
end
|
||||||
url({
|
url({
|
||||||
:headers => {},
|
:headers => {},
|
||||||
:host => "#{bucket_name}.#{@host}",
|
:host => @host,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => CGI.escape(object_name)
|
:path => [bucket_name, CGI.escape(object_name)].join('/')
|
||||||
}, expires)
|
}, expires)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@ module Fog
|
||||||
end
|
end
|
||||||
url({
|
url({
|
||||||
:headers => {},
|
:headers => {},
|
||||||
:host => "#{bucket_name}.#{@host}",
|
:host => @host,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => CGI.escape(object_name)
|
:path => [bucket_name, CGI.escape(object_name)].join('/')
|
||||||
}, expires)
|
}, expires)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,8 @@ module Fog
|
||||||
query << "AWSAccessKeyId=#{@aws_access_key_id}"
|
query << "AWSAccessKeyId=#{@aws_access_key_id}"
|
||||||
query << "Signature=#{CGI.escape(signature(params))}"
|
query << "Signature=#{CGI.escape(signature(params))}"
|
||||||
query << "Expires=#{params[:headers]['Date']}"
|
query << "Expires=#{params[:headers]['Date']}"
|
||||||
"http://#{params[:host]}/#{params[:path]}?#{query.join('&')}"
|
bucket = params[:host].split('.').first
|
||||||
|
"https://#{@host}/#{params[:path]}?#{query.join('&')}"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue