Mercurial > kallithea
annotate scripts/run-all-cleanup @ 8751:ad239692ea95
mail: fix duplicate "From" headers
Problem introduced in 9a0c41175e66: When iterating the headers dict and setting
"msg[key] = value", it wasn't replacing the header but performing add_header so
we sometimes ended up with two From headers.
It is also a general problem that while the headers dict only can contain each
key once, it can contain entries that only differ in casing and thus will fold
to the same message header, making it possible to end up adding duplicate
headers.
"msg.replace_header(key, value)" is not a simple solution to the problem: it
will raise KeyError if no such previous key exists.
Now, make the problem more clear by explicitly using add_header.
Avoid the duplication problem by deleting the key (no matter which casing)
before invoking add_header. Delete promises that "No exception is raised if the
named field isn’t present in the headers".
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 04 Nov 2020 00:35:21 +0100 |
parents | 8d663d23ab85 |
children | 0a84ef075575 |
rev | line source |
---|---|
6060
40edadecda69
run-all-cleanup: fix incorrect interpreter
Søren Løvborg <sorenl@unity3d.com>
parents:
5885
diff
changeset
|
1 #!/bin/sh |
5885
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
2 |
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
3 # Convenience script for running various idempotent source code cleanup scripts |
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
4 |
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
5 set -e |
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
6 set -x |
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
7 |
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
8 scripts/docs-headings.py |
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
9 scripts/generate-ini.py |
f0b9706d8d7e
scripts: introduce scripts/run-all-cleanup - run this before committing to make sure some aspects of the coding style is maintained
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
10 scripts/whitespacecleanup.sh |
8240
51af7c12ffb1
cleanup: run pyflakes as a part of scripts/run-all-cleanup
Mads Kiilerich <mads@kiilerich.com>
parents:
6060
diff
changeset
|
11 |
51af7c12ffb1
cleanup: run pyflakes as a part of scripts/run-all-cleanup
Mads Kiilerich <mads@kiilerich.com>
parents:
6060
diff
changeset
|
12 hg loc 'set:!binary()&grep("^#!.*python")' '*.py' | xargs scripts/pyflakes |
8295
8d663d23ab85
scripts: make output from run-all-cleanup easier to parse
Mads Kiilerich <mads@kiilerich.com>
parents:
8240
diff
changeset
|
13 echo "no blocking problems found by $0" |