From b12185d1099b8b30d54199f7cb7ff7c53abd5900 Mon Sep 17 00:00:00 2001 From: NickOvt Date: Fri, 16 Aug 2024 17:21:28 +0300 Subject: [PATCH] fix(headers): Header parsing fix (#12) * fix provenance * fix urls * remove randexp * refactor originhost and transhost, reuse more code. Add incoming data logging config option * fix example config. Refactor index.js logging * update README, fix README * fix typo readme * allow authenticatedUser in form of username[email] to be parsed correctly * regex changes * regex fixes * remove regex case insensitive * fix header parsing --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ac47de8..3c4a59b 100644 --- a/index.js +++ b/index.js @@ -103,9 +103,12 @@ module.exports.init = async app => { // Change headers to the format that Zilter will accept for (const headerObj of envelope.headers.getList()) { + // Get header Key and Value from line + const splittedByFirstColumn = headerObj.line.split(/:(.*)/s); + messageHeadersList.push({ - name: headerObj.key, - value: headerObj.line + name: splittedByFirstColumn[0].trim(), // Header key + value: splittedByFirstColumn[1].trim() // Rest of string (i.e actual header value) }); }