Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit d8a0289

Browse files
committed
Fix urlEncode to encode tab character
1 parent 7e7e209 commit d8a0289

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

spec/suites/ConsumerSpec.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ test('Basics', function () {
55

66
test('toHeaderString', function () {
77
var params, realm_param, realm_key, realm_val;
8-
8+
99
params = {
1010
realm: 'http://www.example.com',
1111
consumerKey: 'consumerkey',
1212
consumerSecret: 'consumersecret'
1313
};
14-
14+
1515
realm_param = toHeaderString(params).match(/^(realm)="(.+?)"/);
1616
realm_key = realm_param[1];
1717
realm_val = realm_param[2];
@@ -22,7 +22,7 @@ test('toHeaderString', function () {
2222
});
2323

2424
test('toSignatureBaseString', function () {
25-
25+
2626
/**
2727
* Generate a signature base string for the request
2828
*
@@ -35,17 +35,17 @@ test('toSignatureBaseString', function () {
3535
function toSignatureBaseString(method, url, header_params, query_params) {
3636
*/
3737

38-
38+
3939
var s = toSignatureBaseString("GET", "http://www.example.com", {"h1":"v1", "h1-2":"v2"}, {"q1":"v1", "q1-2":"v2"});
40-
40+
4141
equals(s, "GET&http%3A%2F%2Fwww.example.com&h1%3Dv1%26h1-2%3Dv2%26q1%3Dv1%26q1-2%3Dv2");
4242
});
4343

4444

4545
test('Output URL Encode', function () {
4646
equals(OAuth.urlEncode(''), '', 'Output test 1');
47-
equals(OAuth.urlEncode("\r\n $ & < > ? ; # : = , \" ' ~ + %"), '%0D%0A%20%24%20%26%20%3C%20%3E%20%3F%20%3B%20%23%20%3A%20%3D%20%2C%20%22%20%27%20~%20%2B%20%25', 'Output test 2');
48-
47+
equals(OAuth.urlEncode("\t\r\n $ & < > ? ; # : = , \" ' ~ + %"), '%09%0D%0A%20%24%20%26%20%3C%20%3E%20%3F%20%3B%20%23%20%3A%20%3D%20%2C%20%22%20%27%20~%20%2B%20%25', 'Output test 2');
48+
4949
equals(OAuth.urlEncode('ß'), '%C3%9F', 'Output test 3');
5050
equals(OAuth.urlEncode('ü'), '%C3%BC', 'Output test 4');
5151
});
@@ -86,16 +86,16 @@ var oauth = OAuth({
8686
enablePrivilege: false,
8787
consumerKey: 'ba9df9055c77f338',
8888
consumerSecret: '846ffe1ec3b18989e73fe7fff833',
89-
89+
9090
realm: 'http://oauth-sandbox.sevengoslings.net',
9191
requestTokenUrl: 'http://oauth-sandbox.sevengoslings.net/request_token',
9292
authorizationUrl: 'http://oauth-sandbox.sevengoslings.net/authorize',
9393
accessTokenUrl: 'http://oauth-sandbox.sevengoslings.net/access_token'
9494
});
95-
95+
9696

9797
asyncTest("OAuth Authorise", function() {
98-
98+
9999
oauth.fetchRequestToken(function (url) {
100100
var windowObjectReference = window.open(url, 'authorise');
101101

@@ -106,16 +106,16 @@ asyncTest("OAuth Authorise", function() {
106106

107107

108108
document.body.appendChild(mask);
109-
109+
110110
var button = document.getElementById('start-app-button');
111111
button.onclick = function() {
112112
var code = document.getElementById('verification').value;
113113
oauth.setVerifier(code);
114-
114+
115115
oauth.fetchAccessToken(function(data){
116116
ok(true);
117117
start();
118-
118+
119119
}, function (data) {console.log(data)});
120120
};
121121
}, function (data) {console.log(data)});

src/OAuth/Consumer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@
520520
}
521521

522522
string = string + '';
523-
var reserved_chars = /[ \r\n!*"'();:@&=+$,\/?%#\[\]<>{}|`^\\\u0080-\uffff]/,
523+
var reserved_chars = /[ \t\r\n!*"'();:@&=+$,\/?%#\[\]<>{}|`^\\\u0080-\uffff]/,
524524
str_len = string.length, i, string_arr = string.split(''), c;
525525

526526
for (i = 0; i < str_len; i++) {

0 commit comments

Comments
 (0)