Re: [PATCH 01/10] parser: fix charset 'guessing' algorithm

2017-06-28 Thread Stephen Finucane
On Wed, 2017-06-28 at 17:48 +1000, Daniel Axtens wrote:
> 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 

I don't imagine this would ever happen in real world, but then again nothing
would surprise me at this point. Looks good to me. Thus:

Reviewed-by: Stephen Finucane 

and applied.

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


Re: [PATCH 01/10] parser: fix charset 'guessing' algorithm

2017-06-28 Thread Andrew Donnellan

Reviewed-by: Andrew Donnellan 

On 28/06/17 17:48, Daniel Axtens wrote:

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 
---
 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:



--
Andrew Donnellan  OzLabs, ADL Canberra
andrew.donnel...@au1.ibm.com  IBM Australia Limited

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


[PATCH 01/10] parser: fix charset 'guessing' algorithm

2017-06-28 Thread Daniel Axtens
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 
---
 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