On Mon, Dec 13, 2010 at 08:37:25AM +0800, Jeremy Kerr wrote: > Hi Paul, > > > I think this patch needs to be reapplied, after the branch change(?) in > > March 2010 [1]. > > Thanks, good catch, I've reapplied it.
This does now decode twice and raises an exception (on both paths). I don't see a reason for the second time, but attached is a patch that makes it conditional. Try it with this (the copyright sign will be decoded twice): http://patchwork.freedesktop.org/patch/3648/ -- Greetings, Dirk
>From 46ab3dfe76d5a7da05f4d0e84555e1ca9832fd59 Mon Sep 17 00:00:00 2001 From: Dirk Wallenstein <[email protected]> Date: Wed, 12 Jan 2011 19:39:23 +0100 Subject: [PATCH] Prevent repeated decoding in parse_patch Signed-off-by: Dirk Wallenstein <[email protected]> --- apps/patchwork/parser.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/apps/patchwork/parser.py b/apps/patchwork/parser.py index 24631b7..57b25c8 100644 --- a/apps/patchwork/parser.py +++ b/apps/patchwork/parser.py @@ -63,7 +63,10 @@ def parse_patch(text): lc = (0, 0) hunk = 0 - for line in text.decode('utf-8').split('\n'): + if not isinstance(text, unicode): + text = unicode(text, 'utf-8') + + for line in text.split('\n'): line += '\n' if state == 0: -- 1.7.3.2
_______________________________________________ Patchwork mailing list [email protected] https://lists.ozlabs.org/listinfo/patchwork
