You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ponymail.apache.org by sebbASF <gi...@git.apache.org> on 2016/06/14 00:02:16 UTC

[GitHub] incubator-ponymail issue #88: Bug: get by message-id does not work

GitHub user sebbASF opened an issue:

    https://github.com/apache/incubator-ponymail/issues/88

    Bug: get by message-id does not work

    The API.md doc says:
    
    Usage:
    GET /api/email.lua?id=$mid
    
    Parameters: (cookie may be required)
      - $mid: The email ID or Message-ID: header
    
    However, only the email ID works.
    
    The message-ID header search does not.
    
    This appears to be because the header is enclosed in quotes[1] when doing the search.
    
    I think
    
     local docs = elastic.find("message-id:\"" .. r:escape(eid) .. "\"", 1, "mbox")
    
    should probably be
    
     local docs = elastic.find("message-id:" .. r:escape(eid), 1, "mbox")
    
    [1] https://github.com/apache/incubator-ponymail/blob/master/site/api/email.lua#L49

----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-ponymail issue #88: Bug: get by message-id does not work

Posted by sebbASF <gi...@git.apache.org>.
Github user sebbASF commented on the issue:

    https://github.com/apache/incubator-ponymail/issues/88
  
    Something like the following should fix the error:
    
    diff --git a/site/api/email.lua b/site/api/email.lua
    index 1eb3679..e9b47a6 100644
    --- a/site/api/email.lua
    +++ b/site/api/email.lua
    @@ -42,7 +42,7 @@ function handle(r)
         r.content_type = "application/json"
         local get = r:parseargs()
         local eid = (get.id or ""):gsub("\"", "")
    -    local doc = elastic.get("mbox", eid or "hmm")
    +    local _, doc = pcall(function() return elastic.get("mbox", eid or "hmm") end)
         
         -- Try searching by original source mid if not found, for backward compat
         if not doc or not doc.subject then



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-ponymail issue #88: Bug: get by message-id does not work

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the issue at:

    https://github.com/apache/incubator-ponymail/issues/88


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---