From c1e28db0f3d37b507e7aaef6b26557b27f7ab2f3 Mon Sep 17 00:00:00 2001 From: NickOvt Date: Fri, 15 Dec 2023 12:58:03 +0200 Subject: [PATCH] fix(upload): allow empty name field in the Upload message FROM: header ZMS-113 (#577) * allow empty name field in the Upload message FROM: header * allow empty name for reply-to also --- lib/api/messages.js | 14 +++++++++++--- lib/schemas/request/messages-schemas.js | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/api/messages.js b/lib/api/messages.js index c56e2745..47ce63dc 100644 --- a/lib/api/messages.js +++ b/lib/api/messages.js @@ -25,7 +25,15 @@ const { getMongoDBQuery /*, getElasticSearchQuery*/ } = require('../search-query //const { getClient } = require('../elasticsearch'); const BimiHandler = require('../bimi-handler'); -const { Address, AddressOptionalNameArray, Header, Attachment, ReferenceWithAttachments, Bimi } = require('../schemas/request/messages-schemas'); +const { + Address, + AddressOptionalNameArray, + Header, + Attachment, + ReferenceWithAttachments, + Bimi, + AddressOptionalName +} = require('../schemas/request/messages-schemas'); const { userId, mailboxId, messageId } = require('../schemas/request/general-schemas'); const { MsgEnvelope } = require('../schemas/response/messages-schemas'); const { successRes } = require('../schemas/response/general-schemas'); @@ -1895,9 +1903,9 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti 'base64 encoded message source. Alternatively, you can provide this value as POST body by using message/rfc822 MIME type. If raw message is provided then it overrides any other mail configuration' ), - from: Address.description('Addres for the From: header'), + from: AddressOptionalName.description('Addres for the From: header'), - replyTo: Address.description('Address for the Reply-To: header'), + replyTo: AddressOptionalName.description('Address for the Reply-To: header'), to: AddressOptionalNameArray.description('Addresses for the To: header'), diff --git a/lib/schemas/request/messages-schemas.js b/lib/schemas/request/messages-schemas.js index f0844283..bc5b1be6 100644 --- a/lib/schemas/request/messages-schemas.js +++ b/lib/schemas/request/messages-schemas.js @@ -61,6 +61,7 @@ const Bimi = Joi.object({ module.exports = { Address, AddressOptionalNameArray, + AddressOptionalName, Header, Attachment, ReferenceWithAttachments,