Skip to content

Commit

Permalink
mmime: keep (none) whitespace after quoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
leahneukirchen committed Jun 17, 2021
1 parent 0370916 commit d324b92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mmime.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ print_header(char *line) {
}

int prevq = 0; // was the previous word encoded as qp?
char prevqs = 0; // was the previous word a quoted-string?

ssize_t linelen = s - line;

Expand Down Expand Up @@ -354,7 +355,7 @@ print_header(char *line) {
// space at beginning of line
goto force_qp;
}
if (*s != ' ') {
if (*s != ' ' && !(prevqs && !prevq && *(s-1) != ' ')) {
printf(" ");
linelen++;
}
Expand Down Expand Up @@ -388,6 +389,7 @@ print_header(char *line) {
if (qs && *e == '"')
e++;
}
prevqs = qs;
s = e;
}
printf("\n");
Expand Down

0 comments on commit d324b92

Please sign in to comment.