Skip to content

Commit

Permalink
fix: fixed dkim-signature header spanning multiple line breaks with t…
Browse files Browse the repository at this point in the history
…ab \t character (per <andris9/mailsplit#22>)
  • Loading branch information
titanism committed Sep 2, 2024
1 parent 124a5f3 commit 7d1e192
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/models/emails.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,11 @@ Emails.statics.queue = async function (
// ignore, keep as is
}

lines = lines.replace(/[\r\n]+$/, '').split(/\r?\n/);
lines = lines
// <https://github.com/andris9/mailsplit/issues/22>
.replace(/\r?\n?\t/g, ' ')
.replace(/[\r\n]+$/, '')
.split(/\r?\n/);

for (const line of lines) {
const index = line.indexOf(':');
Expand Down
6 changes: 5 additions & 1 deletion helpers/get-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ function getHeaders(headers, specificKey = null) {
// ignore, keep as is
}

lines = lines.replace(/[\r\n]+$/, '').split(/\r?\n/);
lines = lines
// <https://github.com/andris9/mailsplit/issues/22>
.replace(/\r?\n?\t/g, ' ')
.replace(/[\r\n]+$/, '')
.split(/\r?\n/);

for (const line of lines) {
const index = line.indexOf(':');
Expand Down

0 comments on commit 7d1e192

Please sign in to comment.