fix mime atom
This commit is contained in:
parent
d4b1853513
commit
75780c232b
3 changed files with 5 additions and 5 deletions
|
@ -6,7 +6,7 @@ use nom::{
|
||||||
sequence::delimited,
|
sequence::delimited,
|
||||||
};
|
};
|
||||||
use crate::text::whitespace::cfws;
|
use crate::text::whitespace::cfws;
|
||||||
use crate::text::words::mime_token as token;
|
use crate::text::words::mime_atom as token;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Mechanism<'a> {
|
pub enum Mechanism<'a> {
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub fn encoded_word(input: &[u8]) -> IResult<&[u8], EncodedWord> {
|
||||||
|
|
||||||
pub fn encoded_word_quoted(input: &[u8]) -> IResult<&[u8], EncodedWord> {
|
pub fn encoded_word_quoted(input: &[u8]) -> IResult<&[u8], EncodedWord> {
|
||||||
let (rest, (_, charset, _, _, _, txt, _)) = tuple((
|
let (rest, (_, charset, _, _, _, txt, _)) = tuple((
|
||||||
tag("=?"), words::mime_token,
|
tag("=?"), words::mime_atom,
|
||||||
tag("?"), one_of("Qq"),
|
tag("?"), one_of("Qq"),
|
||||||
tag("?"), ptext,
|
tag("?"), ptext,
|
||||||
tag("?=")))(input)?;
|
tag("?=")))(input)?;
|
||||||
|
@ -33,7 +33,7 @@ pub fn encoded_word_quoted(input: &[u8]) -> IResult<&[u8], EncodedWord> {
|
||||||
|
|
||||||
pub fn encoded_word_base64(input: &[u8]) -> IResult<&[u8], EncodedWord> {
|
pub fn encoded_word_base64(input: &[u8]) -> IResult<&[u8], EncodedWord> {
|
||||||
let (rest, (_, charset, _, _, _, txt, _)) = tuple((
|
let (rest, (_, charset, _, _, _, txt, _)) = tuple((
|
||||||
tag("=?"), words::mime_token,
|
tag("=?"), words::mime_atom,
|
||||||
tag("?"), one_of("Bb"),
|
tag("?"), one_of("Bb"),
|
||||||
tag("?"), btext,
|
tag("?"), btext,
|
||||||
tag("?=")))(input)?;
|
tag("?=")))(input)?;
|
||||||
|
|
|
@ -30,8 +30,8 @@ pub enum MIMEWord<'a> {
|
||||||
impl<'a> MIMEWord<'a> {
|
impl<'a> MIMEWord<'a> {
|
||||||
pub fn to_string(&self) -> String {
|
pub fn to_string(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
Quoted(v) => v.to_string(),
|
Self::Quoted(v) => v.to_string(),
|
||||||
Atom(v) => encoding_rs::UTF_8.decode_without_bom_handling(v).1.to_string(),
|
Self::Atom(v) => encoding_rs::UTF_8.decode_without_bom_handling(v).1.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue