mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 19:08:09 +01:00
cli: sanitize tabs and newlines to spaces in notmuch search
Sanitize tabs and newlines to spaces rather than question marks in --output=summary --format=text output. This will also hide any difference in unfolding a header that has been folded with a tab. Our own header parser replaces tabs with spaces, while gmime would retain the tab.
This commit is contained in:
parent
e79d2fc993
commit
6d0a17c46e
2 changed files with 4 additions and 2 deletions
|
@ -41,7 +41,9 @@ sanitize_string (const void *ctx, const char *str)
|
||||||
loop = out = talloc_strdup (ctx, str);
|
loop = out = talloc_strdup (ctx, str);
|
||||||
|
|
||||||
for (; *loop; loop++) {
|
for (; *loop; loop++) {
|
||||||
if ((unsigned char)(*loop) < 32)
|
if (*loop == '\t' || *loop == '\n')
|
||||||
|
*loop = ' ';
|
||||||
|
else if ((unsigned char)(*loop) < 32)
|
||||||
*loop = '?';
|
*loop = '?';
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
|
|
@ -388,7 +388,7 @@ add_message "[subject]='two =?ISO-8859-1?Q?line=0A_subject?=
|
||||||
headers'"
|
headers'"
|
||||||
notmuch search id:"$gen_msg_id" | notmuch_search_sanitize >OUTPUT
|
notmuch search id:"$gen_msg_id" | notmuch_search_sanitize >OUTPUT
|
||||||
cat <<EOF >EXPECTED
|
cat <<EOF >EXPECTED
|
||||||
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; two line? subject headers (inbox unread)
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; two line subject headers (inbox unread)
|
||||||
EOF
|
EOF
|
||||||
test_expect_equal_file OUTPUT EXPECTED
|
test_expect_equal_file OUTPUT EXPECTED
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue