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: Validate date
Date Sat, 09 Dec 2017 14:17:13 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 5e189b875 -> 8ef2678dd


Validate date

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

Branch: refs/heads/master
Commit: 8ef2678dd960c7dae836d4acbf62793cd1a8219b
Parents: 5e189b8
Author: Sebb <sebb@apache.org>
Authored: Sat Dec 9 14:16:59 2017 +0000
Committer: Sebb <sebb@apache.org>
Committed: Sat Dec 9 14:16:59 2017 +0000

----------------------------------------------------------------------
 site/api/mbox.lua | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/8ef2678d/site/api/mbox.lua
----------------------------------------------------------------------
diff --git a/site/api/mbox.lua b/site/api/mbox.lua
index e727921..c485204 100644
--- a/site/api/mbox.lua
+++ b/site/api/mbox.lua
@@ -67,10 +67,16 @@ function handle(r)
         end
         m = tonumber(m)
         y = tonumber(y)
+        local d = utils.lastDayOfMonth(y,m)
+        if not d then
+            cross.contentType(r, "text/plain")
+            r:puts("Invalid date given!\n")
+            return cross.OK
+        end
+
         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
         local docs = elastic.raw {


Mime
View raw message