Skip to content

Commit

Permalink
fix breaking of encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
mathe42 committed Apr 22, 2022
1 parent de65208 commit 7f027e2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ export function quotedPrintableEncode(data: string, encLB = false) {
let old = encodedData.slice(i * 74 + offset, (i + 1) * 74);
offset = 0

if(old[old.length-1] === '=' || old[old.length-2] === '=') {
old += encodedData[(i+1)*74]
offset = 1
if(old.at(-1) === '=') {
old = old.slice(0, old.length - 1)
offset = -1
}

if(old.at(-2) === '=') {
old = old.slice(0, old.length - 2)
offset = -2
}

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

0 comments on commit 7f027e2

Please sign in to comment.