Merge lp:~thumper/launchpad/mail-header-oops into lp:launchpad
Proposed by
Tim Penhey
Status: | Merged |
---|---|
Approved by: | Robert Collins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12566 |
Proposed branch: | lp:~thumper/launchpad/mail-header-oops |
Merge into: | lp:launchpad |
Diff against target: |
241 lines (+91/-30) 4 files modified
lib/lp/services/mail/incoming.py (+36/-20) lib/lp/services/mail/tests/incomingmail.txt (+6/-6) lib/lp/services/mail/tests/test_incoming.py (+44/-1) lib/lp/testing/factory.py (+5/-3) |
To merge this branch: | bzr merge lp:~thumper/launchpad/mail-header-oops |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Approve | ||
Ian Booth (community) | *code | Approve | |
Review via email: mp+52156@code.launchpad.net |
Commit message
[r=lifeless,
Description of the change
Warnings that are logged are turned into OOPSes by the
OOPS log handler added by the base CronScript class.
I've updated the behaviour of the header checking based
on the comments in bug 701976.
To post a comment you must log in.
+def extract_ addresses( mail, raw_mail, file_alias_url, log): Original- To header.
+ # Extract the domain the mail was sent to. Mails sent to
+ # Launchpad should have an X-Launchpad-
Why not turn that into a docstring? And, maybe add things just saying the types of the parameters and the return code. It's the kind of thing that easily has bugs about passing a string vs a list of strings vs a file etc. (Or, you could use a statically type-checked language. :-P)
+ if ORIGINAL_TO_HEADER in mail: TO_HEADER] ]
+ return [mail[ORIGINAL_
+
+ if ORIGINAL_TO_HEADER in raw_mail:
+ # Almost certainly a spam email with a blank line in the email headers
+ log.info('Suspected spam: %s' % file_alias_url)
I really do not see how the comment follows from the condition. How can you even have a blank line in the headers? You can have a blank line that causes things that ought to be headers to be part of the body, but no reasonable mail agent will see them as headers then.
Perhaps this should say something like:
# Doesn't have an X-Launchpad- Original- To in the headers, but does have one in the body, because of a forwarding loop or attempted spam. See <https:/ /bugs.launchpad .net/launchpad/ +bug/701976>