From 01e38ed4cadd2558a9386cbf6106127c28702d00 Mon Sep 17 00:00:00 2001 From: Matthew Fettig Date: Mon, 2 Jun 2014 09:16:48 -0700 Subject: [PATCH] [BUG] merge IE11 signature fix --- src/js/ripple/crypt.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/js/ripple/crypt.js b/src/js/ripple/crypt.js index 0bdd6bbf..bd0ea75e 100644 --- a/src/js/ripple/crypt.js +++ b/src/js/ripple/crypt.js @@ -361,11 +361,19 @@ Crypt.getStringToSign = function(config, parsed, date, mechanism) { // Sort the properties of the JSON object into canonical form var canonicalData = JSON.stringify(copyObjectWithSortedKeys(config.data)); + // We're using URL parsing using browser functionality. Unfortunately the + // parsing result slightly differs in IE - it is missing a leading slash. + // XXX Proper fix would be to use a pure JS URL parser. + var pathname = parsed.pathname; + + // IE11 Workaround + if (pathname[0] !== '/') pathname = '/' + pathname; + // Canonical request using Amazon's v4 signature format // See: http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html var canonicalRequest = [ config.method || 'GET', - parsed.pathname || '', + pathname || '', parsed.search || '', // XXX Headers signing not supported '',