Preserve QOutlook inline EML attachments
This commit is contained in:
@@ -137,6 +137,39 @@ describe("outlookMail helpers", () => {
|
||||
await expect(attachmentToBlob(attachments[0]).text()).resolves.toBe("Привет");
|
||||
});
|
||||
|
||||
it("извлекает inline MIME-вложения с Content-ID и не добавляет бинарную часть в тело", async () => {
|
||||
const body = [
|
||||
"--related",
|
||||
"Content-Type: text/html; charset=utf-8",
|
||||
"",
|
||||
"<p>Logo</p><img src=\"cid:logo\">",
|
||||
"--related",
|
||||
"Content-Type: image/png",
|
||||
"Content-Disposition: inline",
|
||||
"Content-ID: <logo>",
|
||||
"Content-Transfer-Encoding: base64",
|
||||
"",
|
||||
"SGVsbG8=",
|
||||
"--related--"
|
||||
].join("\r\n");
|
||||
const headers = { "content-type": 'multipart/related; boundary="related"' };
|
||||
const attachments = extractMessageAttachments(headers, body);
|
||||
|
||||
expect(extractMessageBody(headers, body)).toBe("Logo");
|
||||
expect(attachments).toEqual([
|
||||
{
|
||||
id: "attachment-вложение-1-1",
|
||||
fileName: "Вложение 1",
|
||||
contentType: "image/png",
|
||||
size: 5,
|
||||
contentBase64: "SGVsbG8=",
|
||||
disposition: "inline",
|
||||
contentId: "logo"
|
||||
}
|
||||
]);
|
||||
await expect(attachmentToBlob(attachments[0]).text()).resolves.toBe("Hello");
|
||||
});
|
||||
|
||||
it("импортирует multipart EML как письмо QOutlook", async () => {
|
||||
const eml = [
|
||||
"From: sender@example.com",
|
||||
|
||||
Reference in New Issue
Block a user