From c695a0d100ad0b50267388aee9212e23a38fcd23 Mon Sep 17 00:00:00 2001 From: jaygarala Date: Fri, 10 Jun 2022 09:07:33 -0400 Subject: [PATCH] Fix URI encoding of special characters Update `fixedEncodeURIComponent` in `sigV4Client` to match a generated client from AWS. This fixes `The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method.` error when using query parameters with special characters, in my case `*`. --- dist/lib/apiGatewayCore/sigV4Client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/lib/apiGatewayCore/sigV4Client.js b/dist/lib/apiGatewayCore/sigV4Client.js index 4a2c67c..3ed172c 100755 --- a/dist/lib/apiGatewayCore/sigV4Client.js +++ b/dist/lib/apiGatewayCore/sigV4Client.js @@ -87,9 +87,9 @@ sigV4ClientFactory.newClient = function (config) { return canonicalQueryString.substr(0, canonicalQueryString.length - 1); } - function fixedEncodeURIComponent(str) { - return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { - return '%' + c.charCodeAt(0).toString(16); + function fixedEncodeURIComponent (str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase(); }); }