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

[aws&google|storage] move path escaping to signed url method

This commit is contained in:
geemus 2011-01-26 14:38:00 -08:00
parent 4b1e581652
commit 08631c85c4
2 changed files with 5 additions and 5 deletions

View file

@ -94,13 +94,13 @@ module Fog
def url(params, expires)
params[:headers]['Date'] = expires.to_i
params[:path] = CGI.escape(params[:path]).gsub('%2F', '/')
query = [params[:query]].compact
query << "AWSAccessKeyId=#{@aws_access_key_id}"
query << "Signature=#{CGI.escape(signature(params))}"
query << "Expires=#{params[:headers]['Date']}"
bucket = params[:host].split('.').first
path = CGI.escape(params[:path]).gsub('%2F', '/')
"https://#{@host}/#{path}?#{query.join('&')}"
"https://#{@host}/#{params[:path]}?#{query.join('&')}"
end
end
@ -343,7 +343,7 @@ DATA
unless subdomain.nil? || subdomain == @host
canonical_resource << "#{CGI.escape(subdomain).downcase}/"
end
canonical_resource << CGI.escape(params[:path].to_s).gsub('%2F', '/')
canonical_resource << params[:path].to_s
canonical_resource << '?'
for key in (params[:query] || {}).keys
if %w{acl location logging notification partNumber policy requestPayment torrent uploadId uploads versionId versioning versions}.include?(key)

View file

@ -54,12 +54,12 @@ module Fog
def url(params, expires)
params[:headers]['Date'] = expires.to_i
params[:path] = CGI.escape(params[:path]).gsub('%2F', '/')
query = [params[:query]].compact
query << "GoogleAccessKeyId=#{@google_storage_access_key_id}"
query << "Signature=#{CGI.escape(signature(params))}"
query << "Expires=#{params[:headers]['Date']}"
path = CGI.escape(params[:path]).gsub('%2F', '/')
"http://#{params[:host]}/#{path}?#{query.join('&')}"
"http://#{params[:host]}/#{params[:path]}?#{query.join('&')}"
end
end