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.lua output filename does not match ISO standard
Date Sat, 09 Dec 2017 14:00:17 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 13ec095b4 -> 5e189b875


mbox.lua output filename does not match ISO standard

This fixes #420

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

Branch: refs/heads/master
Commit: 5e189b875ca117f61abb82a33c45015d68f925fc
Parents: 13ec095
Author: Sebb <sebb@apache.org>
Authored: Sat Dec 9 14:00:02 2017 +0000
Committer: Sebb <sebb@apache.org>
Committed: Sat Dec 9 14:00:02 2017 +0000

----------------------------------------------------------------------
 CHANGELOG.md      |  1 +
 site/api/mbox.lua | 11 +++++------
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5e189b87/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 217a17f..b69597e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
 ## CHANGES in 0.10:
+- mbox.lua output filename does not match ISO standard (#420)
 - Added empty line quotes to JS compaction feature
 - Changed default theme to 'compact'
 - Added --dbprefix for setup.py for proxied ES databases

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5e189b87/site/api/mbox.lua
----------------------------------------------------------------------
diff --git a/site/api/mbox.lua b/site/api/mbox.lua
index 68e164b..e727921 100644
--- a/site/api/mbox.lua
+++ b/site/api/mbox.lua
@@ -59,18 +59,17 @@ function handle(r)
     if get.list and get.date then
         local lid = ("<%s>"):format(get.list:gsub("@", "."):gsub("[<>]", ""))
         local flid = get.list:gsub("[.@]", "_")
-        local month = get.date:match("(%d+%-%d+)")
-        if not month then
+        local y, m = get.date:match("(%d+)%-(%d+)")
+        if not (y and m) then
             cross.contentType(r, "text/plain")
             r:puts("Wrong date format given!\n")
             return cross.OK
         end
-        if r.headers_out then
-            r.headers_out['Content-Disposition'] = "attachment; filename=" .. flid .. "_"
.. month .. ".mbox"
-        end
-        local y, m = month:match("(%d+)%-(%d+)")
         m = tonumber(m)
         y = tonumber(y)
+        if r.headers_out then
+            r.headers_out['Content-Disposition'] = ("attachment; filename=%s_%04d-%02d.mbox"):format(flid,y,m)
+        end
         local d = utils.lastDayOfMonth(y,m)
         
         -- fetch all results from the list (up to 10k results), make sure to get the 'private'
element


Mime
View raw message