1 Return-Path: <patricktotzke@googlemail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 53AEC429E25
\r
6 for <notmuch@notmuchmail.org>; Tue, 16 Aug 2011 14:38:09 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id oQ1SUKZOHfte for <notmuch@notmuchmail.org>;
\r
17 Tue, 16 Aug 2011 14:38:08 -0700 (PDT)
\r
18 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com
\r
19 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 8858C431FB6
\r
22 for <notmuch@notmuchmail.org>; Tue, 16 Aug 2011 14:38:08 -0700 (PDT)
\r
23 Received: by wyg36 with SMTP id 36so282360wyg.26
\r
24 for <notmuch@notmuchmail.org>; Tue, 16 Aug 2011 14:38:07 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=googlemail.com; s=gamma;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=e/foFuv/74ix7Hz5H9mTdtjiA+uEXct+reAf2lznRVQ=;
\r
29 b=rG7Q6Ip0JY/30isGVDXsKZ5P7rwAzLw19nOXZiiEXWNeocc/Q0o0Dz9hQya4nkGif1
\r
30 CjjBJq1UH27BYiJbkZbD3G9Oc8QwYz1fOBiO7ISCPnL0pjIMBtdHD9VteJk1yOKx11k1
\r
31 +ipKjV56zKh3yPLgRC7+pXf6jcowt+xftbyo4=
\r
32 Received: by 10.216.72.139 with SMTP id t11mr142930wed.91.1313530687323;
\r
33 Tue, 16 Aug 2011 14:38:07 -0700 (PDT)
\r
34 Received: from localhost (cpc1-sgyl2-0-0-cust47.sgyl.cable.virginmedia.com
\r
36 by mx.google.com with ESMTPS id z74sm337146weq.23.2011.08.16.14.38.03
\r
37 (version=TLSv1/SSLv3 cipher=OTHER);
\r
38 Tue, 16 Aug 2011 14:38:05 -0700 (PDT)
\r
39 From: Patrick Totzke <patricktotzke@googlemail.com>
\r
40 To: notmuch@notmuchmail.org
\r
41 Subject: [PATCH 2/2] [python] fix unsafe utf-8 decodings
\r
42 Date: Tue, 16 Aug 2011 22:37:47 +0100
\r
43 Message-Id: <1313530667-10648-1-git-send-email-patricktotzke@gmail.com>
\r
44 X-Mailer: git-send-email 1.7.4.1
\r
45 In-Reply-To: <1313155408-17156-1-git-send-email-patricktotzke@gmail.com>
\r
46 References: <1313155408-17156-1-git-send-email-patricktotzke@gmail.com>
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.13
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Tue, 16 Aug 2011 21:38:09 -0000
\r
61 From: pazz <patricktotzke@gmail.com>
\r
63 This prevents unsafe calls to decode for return
\r
64 value None in get_authors/get_subject
\r
66 bindings/python/notmuch/tag.py | 4 +++-
\r
67 bindings/python/notmuch/thread.py | 10 ++++++++--
\r
68 2 files changed, 11 insertions(+), 3 deletions(-)
\r
70 diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py
\r
71 index d6abf28..9eb9fe2 100644
\r
72 --- a/bindings/python/notmuch/tag.py
\r
73 +++ b/bindings/python/notmuch/tag.py
\r
74 @@ -86,7 +86,9 @@ class Tags(object):
\r
75 if not nmlib.notmuch_tags_valid(self._tags):
\r
78 - tag = Tags._get(self._tags).decode('utf-8')
\r
79 + tag = Tags._get(self._tags)
\r
81 + tag = tag.decode('UTF-8')
\r
82 nmlib.notmuch_tags_move_to_next(self._tags)
\r
85 diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py
\r
86 index 120f925..2a55bd9 100644
\r
87 --- a/bindings/python/notmuch/thread.py
\r
88 +++ b/bindings/python/notmuch/thread.py
\r
89 @@ -292,7 +292,10 @@ class Thread(object):
\r
91 if self._thread is None:
\r
92 raise NotmuchError(STATUS.NOT_INITIALIZED)
\r
93 - return Thread._get_authors(self._thread).decode('UTF-8')
\r
94 + authors = Thread._get_authors(self._thread)
\r
96 + return authors.decode('UTF-8')
\r
99 def get_subject(self):
\r
100 """Returns the Subject of 'thread'
\r
101 @@ -302,7 +305,10 @@ class Thread(object):
\r
103 if self._thread is None:
\r
104 raise NotmuchError(STATUS.NOT_INITIALIZED)
\r
105 - return Thread._get_subject(self._thread).decode('UTF-8')
\r
106 + subject = Thread._get_subject(self._thread)
\r
108 + return subject.decode('UTF-8')
\r
111 def get_newest_date(self):
\r
112 """Returns time_t of the newest message date
\r