Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message::parse() panics! #14

Closed
arifd opened this issue Mar 7, 2022 · 6 comments
Closed

Message::parse() panics! #14

arifd opened this issue Mar 7, 2022 · 6 comments

Comments

@arifd
Copy link
Contributor

arifd commented Mar 7, 2022

Hi guys,

Great little library!! But...

This example:

use mail_parser::Message;

const INPUT: &[u8; 314] = br#"From: <redacted@flashmail.net>
Subject: Redacted
To: <redacted@Enron.com>
Message-ID: <105647271315.NCV17523@x263.net>
MIME-version: 1.0
Content-Type: text/html;
 charset=utf-8
Content-Disposition: =?utf-8?Q?invalid?=
Content-Transfer-Encoding: quoted-printable
Content-Disposition: =?utf-8?Q?invalid?=

<p>foo</p>"#;

fn main() {
    let message = Message::parse(INPUT);
    dbg!(message);
}

Will panic with this message:

thread 'main' panicked at 'HeaderValue::get_content_type called on non-ContentType value', /home/arif/.cargo/registry/src/github.com-1ecc6299db9ec823/mail-parser-0.4.4/src/lib.rs:693:18

despite Message::parse advertising it never will; and that it does a best effort.

Could we have a look into it? Thanks!

mdecimus added a commit that referenced this issue Mar 8, 2022
@mdecimus
Copy link
Member

mdecimus commented Mar 8, 2022

Hi, that was actually a bug, thanks for the report! I've just committed the fix to the repository, please could you give it a try?

@arifd
Copy link
Contributor Author

arifd commented Mar 8, 2022

confirmed! Thank you!

@arifd arifd closed this as completed Mar 8, 2022
@arifd
Copy link
Contributor Author

arifd commented Mar 14, 2022

hey @mdecimus, been waiting for an update on crates.io You don't think the bugfix is worth the PATCH version update, as outlined by https://semver.org/?

@mdecimus
Copy link
Member

You are correct but I was waiting to add other fixes/enhancements before pushing a patch to crates.io. Anyway, this week I am going to implement #13 and release a new patch version update. I'll keep you posted!

@mdecimus
Copy link
Member

@arifd Hi, v0.4.5 including this fix is now on crates.io.

@arifd
Copy link
Contributor Author

arifd commented Mar 14, 2022

Thank you! Incredibly responsive!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants