rushmorem / publicsuffix

An implementation of Mozilla's Public Suffix List in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If local-part is missing parse_email() validates successfully

Dango-rs opened this issue · comments

Hi all, first of all great crate, it really can save a lot of time and trouble!

In the process of creating tests I noticed that my panic test can't pass because parse_email("@mail.com") get validated without errors.

So I tried searching across the RFC and some other sources to see if {local-part} is permitted to be empty due to some alias (or catch-all specification) or something similar, however I couldn't find anything on the topic.

In my opinion it should validate as error since I don't believe it should be empty or this is something that I'm concluding wrong?

During debugging I noticed that /src/lib.rs:500 the local var is actually returned as &str but without any length. I believe that a simple condition edit on line 505 would do the job, however I'm still not sure whether that's a mistake or on purpose?
I don't see a test about this case as well.

Since v2, this functionality has been moved to the addr crate, but you shouldn't run into this anymore.