From: Tom Hughes Date: Mon, 29 Apr 2013 09:49:19 +0000 (+0100) Subject: Handle empty arguments when computing the OAuth base string X-Git-Tag: live~5017 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d9d8d5a106e4da75f762a833af51ae920b796064?hp=0d35a10a503f466f5cb7fe41fcb9e0c5167d9ee1 Handle empty arguments when computing the OAuth base string --- diff --git a/vendor/assets/ohauth/ohauth.js b/vendor/assets/ohauth/ohauth.js index 210e859e4..73eb8b9ee 100644 --- a/vendor/assets/ohauth/ohauth.js +++ b/vendor/assets/ohauth/ohauth.js @@ -16,7 +16,9 @@ ohauth.qsString = function(obj) { }; ohauth.stringQs = function(str) { - return str.split('&').reduce(function(obj, pair){ + return str.split('&').filter(function (pair) { + return pair !== ''; + }).reduce(function(obj, pair){ var parts = pair.split('='); obj[decodeURIComponent(parts[0])] = (null === parts[1]) ? '' : decodeURIComponent(parts[1]);