File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ window.hextorstr = function (c) {
11
11
12
12
//this is used to parse base64
13
13
function url_base64_decode ( str ) {
14
- var output = str . replace ( '-' , '+' ) . replace ( '_' , '/' ) ;
14
+ var output = str . replace ( / - / g , '+' ) . replace ( / _ / g , '/' ) ;
15
15
switch ( output . length % 4 ) {
16
16
case 0 :
17
17
break ;
Original file line number Diff line number Diff line change @@ -16,4 +16,9 @@ describe('jwt library wrapper (jwt.js)', function () {
16
16
expect ( result . error ) . to . be . equal ( null ) ;
17
17
expect ( result . result ) . to . be ( true ) ;
18
18
} ) ;
19
+ it ( 'should decode with two underscores' , function ( ) {
20
+ var result = window . decode ( 'eyI_IjoiYWE_In0' ) ;
21
+ expect ( result . error ) . to . be . equal ( null ) ;
22
+ expect ( result . result ) . to . be ( '{\n "?": "aa?"\n}' ) ;
23
+ } ) ;
19
24
} ) ;
You can’t perform that action at this time.
0 commit comments