[PATCH 2/6] Move B and Q decoding into check header.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric W. Biederman
Date: Tuesday, May 23, 2006 - 12:45 pm

B and Q decoding is not appropriate for in body headers, so move
it up to where we explicitly know we have a real email header.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>


---

 mailinfo.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

3cccc5a0728a981cc6f4ea72e81513fd902e29a2
diff --git a/mailinfo.c b/mailinfo.c
index 83a2986..bee7b20 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -324,6 +324,7 @@ static void cleanup_space(char *buf)
 	}
 }
 
+static void decode_header_bq(char *it);
 typedef int (*header_fn_t)(char *);
 struct header_def {
 	const char *name;
@@ -343,6 +344,10 @@ static void check_header(char *line, str
 		int len = header[i].namelen;
 		if (!strncasecmp(line, header[i].name, len) &&
 		    line[len] == ':' && isspace(line[len + 1])) {
+			/* Unwrap inline B and Q encoding, and optionally
+			 * normalize the meta information to utf8.
+			 */
+			decode_header_bq(line + len + 2);
 			header[i].func(line + len + 2);
 			break;
 		}
@@ -597,13 +602,6 @@ static void handle_info(void)
 	cleanup_space(email);
 	cleanup_space(sub);
 
-	/* Unwrap inline B and Q encoding, and optionally
-	 * normalize the meta information to utf8.
-	 */
-	decode_header_bq(name);
-	decode_header_bq(date);
-	decode_header_bq(email);
-	decode_header_bq(sub);
 	printf("Author: %s\nEmail: %s\nSubject: %s\nDate: %s\n\n",
 	       name, email, sub, date);
 }
-- 
1.3.2.g5041c-dirty

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/6] Detect non email patches in git-mailinfo, Eric W. Biederman, (Tue May 23, 12:42 pm)
[PATCH 1/6] Make read_one_header_line return a flag not a ..., Eric W. Biederman, (Tue May 23, 12:44 pm)
[PATCH 2/6] Move B and Q decoding into check header., Eric W. Biederman, (Tue May 23, 12:45 pm)
[PATCH 3/6] Refactor commit messge handling., Eric W. Biederman, (Tue May 23, 12:47 pm)
[PATCH 4/6] In handle_body only read a line if we don't al ..., Eric W. Biederman, (Tue May 23, 12:49 pm)
[PATCH 5/6] More accurately detect header lines in read_on ..., Eric W. Biederman, (Tue May 23, 12:53 pm)
[PATCH 6/6] Allow in body headers beyond the in body heade ..., Eric W. Biederman, (Tue May 23, 12:58 pm)
Re: [PATCH 0/6] Detect non email patches in git-mailinfo, Junio C Hamano, (Tue May 23, 4:44 pm)