-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fix #1474 "Sending message to contact with < or > in Recipient gets treated as "Sent" but is not received" #1476
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me logic-wise, but i would prefer if someone with a better idea of rust than me can also have a look at that
lazy_static! { | ||
static ref ADDR_WITH_NAME_REGEX: Regex = Regex::new("(.*)<(.*)>").unwrap(); | ||
} | ||
if let Some(captures) = ADDR_WITH_NAME_REGEX.captures(addr.as_ref()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use slice pattern to avoid indexing captures
and ensuring that there are exactly 2 groups captured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shortest way I found to do this was:
if let Some(captures) = ADDR_WITH_NAME_REGEX.captures(addr.as_ref()) {
if let [n, a] = &captures.iter().collect::<Vec<_>>()[..] {
...
because
- it is not that easy to build a slice from a
Captures
struct - a slice is not owned, so I can't use
map
but need the twoif
s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I do not think this is worth it because it introduces quite some complexity (unless there is a way to express this shorter I did not find)
as this not fixes a critical bug, compared to the other fixes, but touches pretty critical things on incoming mails, i think we should merge this to master after we released android 1.8.1 resp. core1.33 |
95eafa9
to
f5cd8f2
Compare
The CI is failing with a timeout. From the logs:
Seems that DC receives a mail with Should we change merlinux's mail server configuration? Or fix this so that the mailer deamon does not have to send us messages (they probably say that the message could not be sent)? Or be more relaxed when receiving messages (I do not think that we should accept mails where FROM is bad but we could add them to the database to avoid downloading them again; leaving |
It is rejected because |
So, what do we do? Use the unstable version from master? Wait for the mailparse update? Or be more strict later and only merge the sanitize_name_and_addr() thing now? |
address-comment parsing is at least not breaking anymore:
staktrace/mailparse@3e29988
i think we could pull in that commit (or master) from mailparse in our Cargo.toml.
i also opened staktrace/mailparse#66 to ask for
a new release.
…On Sun, May 17, 2020 at 04:39 -0700, Hocuri wrote:
So, what do we do? Use the unstable version from master? Wait for the mailparse update? Or be more strict later and only merge the sanitize_name_and_addr() thing now?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#1476 (comment)
|
f5cd8f2
to
6fdca87
Compare
Yay, it works! Shall I merge this PR? |
dd6ac94
to
b9c21e7
Compare
Fix #1474 "Sending message to contact with < or > in Recipient gets treated as "Sent" but is not received".
As I was at it, I also extracted the correct name and address from addresses like
Mueller, Dave <dave@domain.com>
.