~emersion/public-inbox

emailthreads: Don't strip whitespace from lines v1 APPLIED

Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/%3C20190509192014.7886-1-sir%40cmpwn.com%3E/mbox | git am -3
Learn more about email & git

[PATCH emailthreads 1/2] Don't strip whitespace from lines Export this patch

---
 emailthreads/quotes.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/emailthreads/quotes.py b/emailthreads/quotes.py
index d7ebe53..4dd6b5d 100644
--- a/emailthreads/quotes.py
+++ b/emailthreads/quotes.py
@@ -60,8 +60,6 @@ def parse_blocks(msg):
 	block_lines = []
 	was_quoted = False
 	for (i, line) in enumerate(text_lines):
-		line = line.strip()
-
 		line_quoted = line.startswith(">")
 		if line_quoted:
 			line = line[1:].lstrip()
-- 
2.21.0

[PATCH emailthreads 2/2] Ignore UTF-8 errors when decoding emails Export this patch

---
 emailthreads/threads.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emailthreads/threads.py b/emailthreads/threads.py
index 6b7c809..6f6a207 100644
--- a/emailthreads/threads.py
+++ b/emailthreads/threads.py
@@ -41,7 +41,7 @@ def normalize_whitespace(text):
 
 def get_text(msg):
 	text_part = get_text_part(msg)
-	text = text_part.get_payload(decode=True).decode('utf-8')
+	text = text_part.get_payload(decode=True).decode('utf-8', 'ignore')
 	text = normalize_whitespace(text)
 	return text
 
-- 
2.21.0
Both pushed:

To git.sr.ht:~emersion/python-emailthreads
   0cfaa6d87d62..5ad9e326708d  master -> master

Thanks!
View this thread in the archives