From 176943b9658b1fa9ae3972156100d831d19c3576 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 17 Sep 2012 14:17:58 -0700 Subject: mailinfo: do not concatenate charset= attribute values from mime headers "Content-type: text/plain; charset=UTF-8" header should not appear twice in the input, but it is always better to gracefully deal with such a case. The current code concatenates the value to the values we have seen previously, producing nonsense such as "utf8UTF-8". Instead of concatenating, forget the previous value and use the last value we see. Signed-off-by: Junio C Hamano --- t/t5100/info0017 | 5 +++++ t/t5100/msg0017 | 2 ++ t/t5100/patch0017 | 6 ++++++ t/t5100/sample.mbox | 16 ++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 t/t5100/info0017 create mode 100644 t/t5100/msg0017 create mode 100644 t/t5100/patch0017 (limited to 't/t5100') diff --git a/t/t5100/info0017 b/t/t5100/info0017 new file mode 100644 index 0000000000..d2bc89ffe9 --- /dev/null +++ b/t/t5100/info0017 @@ -0,0 +1,5 @@ +Author: A U Thor +Email: a.u.thor@example.com +Subject: A E I O U +Date: Mon, 17 Sep 2012 14:23:44 -0700 + diff --git a/t/t5100/msg0017 b/t/t5100/msg0017 new file mode 100644 index 0000000000..2ee0900850 --- /dev/null +++ b/t/t5100/msg0017 @@ -0,0 +1,2 @@ +New content here + diff --git a/t/t5100/patch0017 b/t/t5100/patch0017 new file mode 100644 index 0000000000..35cf84c9a1 --- /dev/null +++ b/t/t5100/patch0017 @@ -0,0 +1,6 @@ +diff --git a/foo b/foo +index e69de29..d95f3ad 100644 +--- a/foo ++++ b/foo +@@ -0,0 +1 @@ ++New content diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox index de1031241d..fcc0e0d202 100644 --- a/t/t5100/sample.mbox +++ b/t/t5100/sample.mbox @@ -683,3 +683,19 @@ index e69de29..d95f3ad 100644 @@ -0,0 +1 @@ +content +From nobody Mon Sep 17 00:00:00 2001 +From: A U Thor +Subject: A E I O U +Date: Mon, 17 Sep 2012 14:23:44 -0700 +MIME-Version: 1.0 +Content-Type: text/plain; charset="iso-2022-jp" +Content-type: text/plain; charset="UTF-8" + +New content here + +diff --git a/foo b/foo +index e69de29..d95f3ad 100644 +--- a/foo ++++ b/foo +@@ -0,0 +1 @@ ++New content -- cgit v1.2.3