melib/envelope: decode other_headers values

async
Manos Pitsidianakis 2019-12-12 10:58:47 +02:00
parent 59f7f03d64
commit d9b568cfb4
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 10 additions and 2 deletions

View File

@ -302,8 +302,16 @@ impl Envelope {
}
} else {
self.other_headers.insert(
String::from_utf8_lossy(name).into(),
String::from_utf8_lossy(value).into(),
String::from_utf8(name.to_vec())
.unwrap_or_else(|err| String::from_utf8_lossy(&err.into_bytes()).into()),
parser::phrase(value)
.to_full_result()
.map(|value| {
String::from_utf8(value).unwrap_or_else(|err| {
String::from_utf8_lossy(&err.into_bytes()).into()
})
})
.unwrap_or_else(|_| String::from_utf8_lossy(value).into()),
);
}
}