Bug 1734210 - Fix sending default custom header value with colons. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D127606

--HG--
extra : histedit_source : 99803a0e1056a63a7166b80c970e9ec3101ff2e5
This commit is contained in:
Ping Chen 2021-10-06 02:05:20 +00:00
Родитель 445a136095
Коммит c80144e2dc
2 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -164,10 +164,10 @@ var MsgUtils = {
// mail.identity.<id#>.header.<header name> grab all the headers
let attrValue = userIdentity.getUnicharAttribute(`header.${attr}`);
if (attrValue) {
let [headerName, headerValue] = attrValue.split(":");
let colonIndex = attrValue.indexOf(":");
headers.push({
headerName,
headerValue,
headerName: attrValue.slice(0, colonIndex),
headerValue: attrValue.slice(colonIndex + 1).trim(),
});
}
}

Просмотреть файл

@ -346,7 +346,10 @@ async function testSendHeaders() {
getBasicSmtpServer()
);
identity.setCharAttribute("headers", "bah,humbug");
identity.setCharAttribute("header.bah", "X-Custom-1: A header value");
identity.setCharAttribute(
"header.bah",
"X-Custom-1: A header value: with a colon"
);
identity.setUnicharAttribute("header.humbug", "X-Custom-2: Enchanté");
identity.setCharAttribute("subscribed_mailing_lists", "list@test.invalid");
identity.setCharAttribute(
@ -357,7 +360,7 @@ async function testSendHeaders() {
fields.cc = "not-list@test.invalid";
await richCreateMessage(fields, [], identity);
checkDraftHeaders({
"X-Custom-1": "A header value",
"X-Custom-1": "A header value: with a colon",
"X-Custom-2": "=?UTF-8?B?RW5jaGFudMOp?=",
"Mail-Followup-To": "list@test.invalid, not-list@test.invalid",
"Mail-Reply-To": undefined,
@ -368,7 +371,7 @@ async function testSendHeaders() {
fields.cc = "";
await richCreateMessage(fields, [], identity);
checkDraftHeaders({
"X-Custom-1": "A header value",
"X-Custom-1": "A header value: with a colon",
"X-Custom-2": "=?UTF-8?B?RW5jaGFudMOp?=",
"Mail-Reply-To": "from@tinderbox.invalid",
"Mail-Followup-To": undefined,