]> git.openstreetmap.org Git - rails.git/commitdiff
Handle empty arguments when computing the OAuth base string
authorTom Hughes <tom@compton.nu>
Mon, 29 Apr 2013 09:49:19 +0000 (10:49 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 29 Apr 2013 09:49:19 +0000 (10:49 +0100)
vendor/assets/ohauth/ohauth.js

index 210e859e4c57b0ce3412f3aba5dcfaa7b41afb61..73eb8b9eeec5756c63ce6701c7a893fbaab95d04 100644 (file)
@@ -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]);