We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b2e436 commit 5e1dbf5Copy full SHA for 5e1dbf5
encodings/base64/base64.js
@@ -86,7 +86,7 @@ function base64Encode(text){
86
87
//must encode one complete quanta at a time
88
for(i=0; i < quantaCount; i++){
89
- for (j=0; j < 4; j++){
+ for (j=0; j < 4 && bits.length; j++){
90
part = bits.splice(0, 6).join("");
91
index = parseInt(part,2);
92
result.push(digits.charAt(index));
@@ -98,10 +98,12 @@ function base64Encode(text){
98
case 8:
99
padRight(bits, 12);
100
padding = "==";
101
+ quantaCount = 1;
102
continue encodeBits;
103
case 16:
104
padRight(bits, 18);
105
padding = "=";
106
107
108
default:
109
break encodeBits;
0 commit comments