From 11f71a05c7532ad7c581232640e73b722bb55563 Mon Sep 17 00:00:00 2001 From: NickOvt Date: Thu, 3 Oct 2024 11:12:50 +0300 Subject: [PATCH] fix(log-headerfromvalue): graylog header from value should be MIME decoded before logging ZMS-138 (#46) --- index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 409da68..b66c073 100644 --- a/index.js +++ b/index.js @@ -403,7 +403,16 @@ exports.hook_deny = function (next, connection, params) { if (headerFrom) { logdata._header_from = headerFrom.address; logdata._header_from_name = headerFrom.provided && headerFrom.provided.name; - logdata._header_from_value = txn.header.get_all('From').join('; '); + + let fromHeadersValue = txn.header.get_all('From').join('; '); + + try { + fromHeadersValue = libmime.decodeWords(fromHeadersValue); + } catch { + // return as is + } + + logdata._header_from_value = fromHeadersValue; } const err = params && params[1];