You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/06/02 12:54:36 UTC

[incubator-ponymail-foal] branch master updated: body can be either bytes or a Body class, account for this

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new fe73149  body can be either bytes or a Body class, account for this
     new 222c3d9  Merge branch 'master' of github.com:apache/incubator-ponymail-foal
fe73149 is described below

commit fe7314920a07ab912d2292052bccf5c385ee2a1c
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Jun 2 14:53:32 2021 +0200

    body can be either bytes or a Body class, account for this
---
 tools/plugins/generators_old.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/plugins/generators_old.py b/tools/plugins/generators_old.py
index cf806e7..81a1618 100644
--- a/tools/plugins/generators_old.py
+++ b/tools/plugins/generators_old.py
@@ -56,7 +56,10 @@ def medium(msg, body, lid, _attachments, _raw_msg):
     """
 
     # Use text body
-    xbody = body.encode('utf-8', 'ignore')
+    if not isinstance(body, bytes):
+        xbody = body.string.encode('utf-8')
+    else:
+        xbody = body
     # Use List ID
     xbody += bytes(lid, encoding='ascii')
     # Use Date header