fix: invalid byte sequence for encoding (#13387)

/closes #13366

cc
@FelixMalfait
This commit is contained in:
neo773
2025-07-23 21:45:08 +05:30
committed by GitHub
parent f439a6cd9e
commit c769f9f2d2

View File

@ -104,12 +104,13 @@ export class ImapGetMessagesService {
const direction = computeMessageDirection(fromHandle, connectedAccount); const direction = computeMessageDirection(fromHandle, connectedAccount);
const text = sanitizeString(textWithoutReplyQuotations); const text = sanitizeString(textWithoutReplyQuotations);
const subject = sanitizeString(parsed.subject || '');
return { return {
externalId: messageId, externalId: messageId,
messageThreadExternalId: threadId || messageId, messageThreadExternalId: threadId || messageId,
headerMessageId: parsed.messageId || messageId, headerMessageId: parsed.messageId || messageId,
subject: parsed.subject || '', subject: subject,
text: text, text: text,
receivedAt: parsed.date || new Date(), receivedAt: parsed.date || new Date(),
direction: direction, direction: direction,
@ -199,9 +200,11 @@ export class ImapGetMessagesService {
if (addressObject && 'value' in addressObject) { if (addressObject && 'value' in addressObject) {
for (const addr of addressObject.value) { for (const addr of addressObject.value) {
if (addr.address) { if (addr.address) {
const name = sanitizeString(addr.name);
addresses.push({ addresses.push({
address: addr.address, address: addr.address,
name: addr.name || '', name: name,
}); });
} }
} }