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

Escape Lambda function name in request paths

This commit is contained in:
Miguel Landaeta 2015-06-24 21:18:59 -03:00
parent 9d405e28cc
commit 03a06c9fa8

View file

@ -124,7 +124,8 @@ module Fog
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
request_path = "/#{@version}#{params.delete(:path)}"
path = params.delete(:path)
request_path = "/#{@version}#{path}"
query = params.delete(:query) || {}
method = params.delete(:method) || 'POST'
expects = params.delete(:expects) || 200
@ -132,6 +133,13 @@ module Fog
headers.merge!(params[:headers] || {})
request_path_to_sign = case path
when %r{^/functions/([0-9a-zA-Z\:\-\_]+)(/.+)?$}
"/#{@version}/functions/#{Fog::AWS.escape($~[1])}#{$~[2]}"
else
request_path
end
body, headers = AWS.signed_params_v4(
params,
headers,
@ -140,7 +148,7 @@ module Fog
:aws_session_token => @aws_session_token,
:signer => @signer,
:host => @host,
:path => request_path,
:path => request_path_to_sign,
:port => @port,
:query => query,
:body => params[:body]