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 2017/05/05 18:23:47 UTC
[1/2] incubator-ponymail git commit: revert
Repository: incubator-ponymail
Updated Branches:
refs/heads/master c4e38edb4 -> ec98f45ea
revert
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/3cba9d78
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/3cba9d78
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/3cba9d78
Branch: refs/heads/master
Commit: 3cba9d78c56a25247e432c75a798bca05f5ba49f
Parents: c4e38ed
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri May 5 20:22:59 2017 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri May 5 20:22:59 2017 +0200
----------------------------------------------------------------------
site/api/source.lua | 16 ----------------
1 file changed, 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/3cba9d78/site/api/source.lua
----------------------------------------------------------------------
diff --git a/site/api/source.lua b/site/api/source.lua
index 95dcc5f..5de4dec 100644
--- a/site/api/source.lua
+++ b/site/api/source.lua
@@ -23,18 +23,6 @@ local user = require 'lib/user'
local cross = require 'lib/cross'
local utils = require 'lib/utils'
-function is_base64(msg)
- -- base64 is always a multiple of 4
- if #msg % 4 == 0 then
- -- base64 only has a-zA-Z0-9+=/ in it
- if not msg:match("([^a-zA-Z0-9+=/])") then
- -- very likely base64 :)
- return true
- end
- end
- return false
-end
-
function handle(r)
-- content is currently utf-8, see #367
cross.contentType(r, "text/plain; charset=utf-8")
@@ -58,10 +46,6 @@ function handle(r)
if aaa.canAccessDoc(r, doc, account) then
local doc_raw = elastic.get('mbox_source', doc.request_id)
if doc_raw then
- -- If this could be base64, try to convert it.
- if is_base64(doc_raw.source) then
- pcall(function() doc_raw.source = r:base64_decode(doc_raw.source) end)
- end
r:puts(doc_raw.source)
else
r:puts("Could not find the email source, sorry!")
[2/2] incubator-ponymail git commit: small optimisations
Posted by hu...@apache.org.
small optimisations
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/ec98f45e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/ec98f45e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/ec98f45e
Branch: refs/heads/master
Commit: ec98f45ea7ea34b7abfc13dc9105daabfc105e92
Parents: 3cba9d7
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri May 5 20:23:10 2017 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri May 5 20:23:10 2017 +0200
----------------------------------------------------------------------
site/api/lib/elastic.lua | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/ec98f45e/site/api/lib/elastic.lua
----------------------------------------------------------------------
diff --git a/site/api/lib/elastic.lua b/site/api/lib/elastic.lua
index 3a1505b..6588319 100644
--- a/site/api/lib/elastic.lua
+++ b/site/api/lib/elastic.lua
@@ -20,7 +20,7 @@
local http = require 'socket.http'
local JSON = require 'cjson'
local config = require 'lib/config'
-local mime = require('mime')
+local mime = require 'mime'
local default_doc = "mbox"
-- http code return check
@@ -113,7 +113,7 @@ local function getDoc (ty, id, ok404)
local src = json._source.source
-- could it be base64 encoded?
-- Unencoded source must contain at least one space; b64 does not
- if src:len() % 4 == 0 and src:find(' ') == nil then
+ if #src % 4 == 0 and src:find(' ') == nil then
src = (mime.unb64(src))
if src ~= nil then
json._source.source = src