Replace the hyperx ContentLocation header with our own implementation (#603)

This commit is contained in:
Paolo Barbolini
2021-04-24 18:00:36 +02:00
committed by GitHub
parent 8afa442e93
commit 2ad2444183
3 changed files with 7 additions and 3 deletions

View File

@@ -1,8 +1,7 @@
//! Headers widely used in email messages
pub use hyperx::header::{
Charset, ContentDisposition, ContentLocation, DispositionParam, DispositionType, Header,
Headers,
Charset, ContentDisposition, DispositionParam, DispositionType, Header, Headers,
};
pub use self::content_type::{ContentType, ContentTypeErr};

View File

@@ -88,6 +88,11 @@ text_header! {
/// defined in [RFC2045](https://tools.ietf.org/html/rfc2045#section-7)
Header(ContentId, "Content-ID")
}
text_header! {
/// `Content-Location` header,
/// defined in [RFC2110](https://tools.ietf.org/html/rfc2110#section-4.3)
Header(ContentLocation, "Content-Location")
}
fn parse_text(raw: &[u8]) -> HyperResult<String> {
if let Ok(src) = from_utf8(raw) {

View File

@@ -669,7 +669,7 @@ mod test {
.body(String::from("<p>Текст <em>письма</em> в <a href=\"https://ru.wikipedia.org/wiki/Юникод\">уникоде</a><p>")))
.singlepart(SinglePart::builder()
.header(header::ContentType::parse("image/png").unwrap())
.header(header::ContentLocation("/image.png".into()))
.header(header::ContentLocation::from(String::from("/image.png")))
.header(header::ContentTransferEncoding::Base64)
.body(String::from("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"))))
.singlepart(SinglePart::builder()