From 7d1e192516d29773130ac5c3d2f7c7daaea5941b Mon Sep 17 00:00:00 2001 From: titanism <101466223+titanism@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:52:37 -0500 Subject: [PATCH] fix: fixed dkim-signature header spanning multiple line breaks with tab \t character (per ) --- app/models/emails.js | 6 +++++- helpers/get-headers.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/emails.js b/app/models/emails.js index a5bc00114e..8bbb320233 100644 --- a/app/models/emails.js +++ b/app/models/emails.js @@ -915,7 +915,11 @@ Emails.statics.queue = async function ( // ignore, keep as is } - lines = lines.replace(/[\r\n]+$/, '').split(/\r?\n/); + lines = lines + // + .replace(/\r?\n?\t/g, ' ') + .replace(/[\r\n]+$/, '') + .split(/\r?\n/); for (const line of lines) { const index = line.indexOf(':'); diff --git a/helpers/get-headers.js b/helpers/get-headers.js index 64c92401c3..8e7f60644b 100644 --- a/helpers/get-headers.js +++ b/helpers/get-headers.js @@ -28,7 +28,11 @@ function getHeaders(headers, specificKey = null) { // ignore, keep as is } - lines = lines.replace(/[\r\n]+$/, '').split(/\r?\n/); + lines = lines + // + .replace(/\r?\n?\t/g, ' ') + .replace(/[\r\n]+$/, '') + .split(/\r?\n/); for (const line of lines) { const index = line.indexOf(':');