Skip to content

Commit 7f027e2

Browse files
committed
fix breaking of encoding
1 parent de65208 commit 7f027e2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

encoding.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ export function quotedPrintableEncode(data: string, encLB = false) {
3939
let old = encodedData.slice(i * 74 + offset, (i + 1) * 74);
4040
offset = 0
4141

42-
if(old[old.length-1] === '=' || old[old.length-2] === '=') {
43-
old += encodedData[(i+1)*74]
44-
offset = 1
42+
if(old.at(-1) === '=') {
43+
old = old.slice(0, old.length - 1)
44+
offset = -1
45+
}
46+
47+
if(old.at(-2) === '=') {
48+
old = old.slice(0, old.length - 2)
49+
offset = -2
4550
}
4651

4752
if (old.endsWith("\r") || old.endsWith("\n")) {

0 commit comments

Comments
 (0)