The charset guessing algorithm doesn't work if it has to guess
multiple charsets, as it overwrites the payload with None.

Signed-off-by: Daniel Axtens <d...@axtens.net>
---
 patchwork/parser.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/patchwork/parser.py b/patchwork/parser.py
index 794a5eac2d29..4903aa8237e6 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -448,10 +448,11 @@ def _find_content(mail):
 
             for cset in try_charsets:
                 try:
-                    payload = six.text_type(payload, cset)
+                    new_payload = six.text_type(payload, cset)
                     break
                 except UnicodeDecodeError:
-                    payload = None
+                    new_payload = None
+            payload = new_payload
 
             # Could not find a valid decoded payload.  Fail.
             if payload is None:
-- 
2.11.0

_______________________________________________
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to