[storage] don't cgi escape slashes in authed urls

This commit is contained in:
geemus 2010-12-14 10:49:40 -08:00
parent 9548c0385b
commit 532bbe31e0
6 changed files with 16 additions and 14 deletions

View File

@ -28,7 +28,7 @@ module Fog
:headers => {}, :headers => {},
:host => @host, :host => @host,
:method => 'GET', :method => 'GET',
:path => [bucket_name, CGI.escape(object_name)].join('/') :path => "#{bucket_name}/#{object_name}"
}, expires) }, expires)
end end
@ -47,7 +47,7 @@ module Fog
:headers => {}, :headers => {},
:host => @host, :host => @host,
:method => 'GET', :method => 'GET',
:path => [bucket_name, CGI.escape(object_name)].join('/') :path => "#{bucket_name}/#{object_name}"
}, expires) }, expires)
end end

View File

@ -28,7 +28,7 @@ module Fog
:headers => {}, :headers => {},
:host => @host, :host => @host,
:method => 'PUT', :method => 'PUT',
:path => [bucket_name, CGI.escape(object_name)].join('/') :path => "#{bucket_name}/#{object_name}"
}, expires) }, expires)
end end
@ -47,7 +47,7 @@ module Fog
:headers => {}, :headers => {},
:host => @host, :host => @host,
:method => 'PUT', :method => 'PUT',
:path => [bucket_name, CGI.escape(object_name)].join('/') :path => "#{bucket_name}/#{object_name}"
}, expires) }, expires)
end end

View File

@ -81,7 +81,8 @@ module Fog
query << "Signature=#{CGI.escape(signature(params))}" query << "Signature=#{CGI.escape(signature(params))}"
query << "Expires=#{params[:headers]['Date']}" query << "Expires=#{params[:headers]['Date']}"
bucket = params[:host].split('.').first bucket = params[:host].split('.').first
"https://#{@host}/#{params[:path]}?#{query.join('&')}" path = CGI.escape(params[:path]).gsub('%2F', '/')
"https://#{@host}/#{path}?#{query.join('&')}"
end end
end end

View File

@ -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}/#{object_name}"
}, 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}/#{object_name}"
}, expires) }, expires)
end end

View File

@ -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}/#{object_name}"
}, 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}/#{object_name}"
}, expires) }, expires)
end end

View File

@ -57,7 +57,8 @@ module Fog
query << "GoogleAccessKeyId=#{@google_storage_access_key_id}" query << "GoogleAccessKeyId=#{@google_storage_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('&')}" path = CGI.escape(params[:path]).gsub('%2F', '/')
"http://#{params[:host]}/#{path}?#{query.join('&')}"
end end
end end