File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
packages/shared/src/utils Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,16 @@ export function base64Decode(str: string) {
18
18
const base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
19
19
let result = ''
20
20
let i = 0
21
- do {
21
+ while ( i < str . length ) {
22
22
const a = base64Chars . indexOf ( str [ i ++ ] )
23
23
const b = base64Chars . indexOf ( str [ i ++ ] )
24
24
const c = base64Chars . indexOf ( str [ i ++ ] )
25
25
const d = base64Chars . indexOf ( str [ i ++ ] )
26
26
result += String . fromCharCode ( a << 2 | b >> 4 )
27
- c !== 64 && ( result += String . fromCharCode ( b << 4 | c >> 2 ) )
28
- d !== 64 && ( result += String . fromCharCode ( c << 6 | d ) )
29
- } while ( i < str . length )
27
+ if ( c !== - 1 )
28
+ result += String . fromCharCode ( ( b & 15 ) << 4 | c >> 2 )
29
+ if ( d !== - 1 )
30
+ result += String . fromCharCode ( ( c & 3 ) << 6 | d )
31
+ }
30
32
return result
31
33
}
You can’t perform that action at this time.
0 commit comments