mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-01 18:44:01 +08:00
[local-sync] Fix a couple of message parsing bugs
Summary: - Don't fail if there's no subject, just set it to `(no subject)` - Support "BINARY" content-transfer-encoding. (This really means that there is no encoding, so it's simple to add support for it) Test Plan: tested locally Reviewers: jackie Reviewed By: jackie Differential Revision: https://phab.nylas.com/D3528
This commit is contained in:
parent
1d254a7aaa
commit
5a7aa45629
1 changed files with 2 additions and 2 deletions
|
@ -112,7 +112,7 @@ async function parseFromImap(imapMessage, desiredParts, {db, accountId, folder})
|
|||
const body = {}
|
||||
for (const {id, mimetype, transferEncoding, charset} of desiredParts) {
|
||||
// see https://www.w3.org/Protocols/rfc1341/5_Content-Transfer-Encoding.html
|
||||
if (!transferEncoding || new Set(['7bit', '8bit']).has(transferEncoding.toLowerCase())) {
|
||||
if (!transferEncoding || new Set(['7bit', '8bit', 'binary']).has(transferEncoding.toLowerCase())) {
|
||||
// NO transfer encoding has been performed --- how to decode to a string
|
||||
// depends ONLY on the charset, which defaults to 'ascii' according to
|
||||
// https://tools.ietf.org/html/rfc2045#section-5.2
|
||||
|
@ -152,7 +152,7 @@ async function parseFromImap(imapMessage, desiredParts, {db, accountId, folder})
|
|||
headers: parsedHeaders,
|
||||
headerMessageId: parsedHeaders['message-id'] ? parsedHeaders['message-id'][0] : '',
|
||||
gMsgId: parsedHeaders['x-gm-msgid'],
|
||||
subject: parsedHeaders.subject[0],
|
||||
subject: parsedHeaders.subject ? parsedHeaders.subject[0] : '(no subject)',
|
||||
}
|
||||
parsedMessage.id = Message.hash(parsedMessage)
|
||||
|
||||
|
|
Loading…
Reference in a new issue