ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject incubator-ponymail git commit: mbox export now escapes 'From ' lines in body text
Date Fri, 09 Dec 2016 20:25:51 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master fd999621b -> 7539a2c37


mbox export now escapes 'From ' lines in body text

This fixes #188

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/7539a2c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/7539a2c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/7539a2c3

Branch: refs/heads/master
Commit: 7539a2c379995cc97042c4eb646135d8eb5facbb
Parents: fd99962
Author: Sebb <sebb@apache.org>
Authored: Fri Dec 9 20:25:42 2016 +0000
Committer: Sebb <sebb@apache.org>
Committed: Fri Dec 9 20:25:42 2016 +0000

----------------------------------------------------------------------
 CHANGELOG.md      | 1 +
 site/api/mbox.lua | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/7539a2c3/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 893f0c4..15ae37b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
 ## CHANGES in 0.10:
 - private messages are now included in downloads if the user has access to them (#169, #108)
 - mbox export now generates valid From_ line (#190)
+- mbox export now escapes 'From ' lines in body text (#188)
 
 ## CHANGES in 0.9b:
 

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/7539a2c3/site/api/mbox.lua
----------------------------------------------------------------------
diff --git a/site/api/mbox.lua b/site/api/mbox.lua
index 1a24ead..afefcf5 100644
--- a/site/api/mbox.lua
+++ b/site/api/mbox.lua
@@ -141,7 +141,14 @@ function handle(r)
                 if doc and doc.source then
                     r:puts(getFromLine(r, doc.source))
                     r:puts("\n")
-                    r:puts(doc.source)
+                    -- pick out individual lines (including last which may not have EOL)
+                    for line in doc.source:gmatch("[^\r\n]*\r?\n?") do
+                        -- check if 'From ' needs to be escaped
+                        if line:match("^From ") then r:puts(">") end
+                        -- TODO consider whether to optionally prefix '>From ', '^>>From
' etc. 
+                        -- If so, just change the RE to "^>*From "
+                        r:puts(line) -- original line
+                    end
                     r:puts("\n")
                 end
             end


Mime
View raw message