mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2024-11-27 16:24:04 +00:00
fixes mailhog/MailHog#148 and fixes mailhog/storage#7
This commit is contained in:
parent
286e8f43f1
commit
d4927bc7e6
4 changed files with 38 additions and 31 deletions
7
vendor/github.com/mailhog/data/message.go
generated
vendored
7
vendor/github.com/mailhog/data/message.go
generated
vendored
|
@ -165,7 +165,9 @@ func (m *SMTPMessage) Bytes() io.Reader {
|
||||||
// FromBytes returns a SMTPMessage from raw message bytes (as output by SMTPMessage.Bytes())
|
// FromBytes returns a SMTPMessage from raw message bytes (as output by SMTPMessage.Bytes())
|
||||||
func FromBytes(b []byte) *SMTPMessage {
|
func FromBytes(b []byte) *SMTPMessage {
|
||||||
msg := &SMTPMessage{}
|
msg := &SMTPMessage{}
|
||||||
|
var headerDone bool
|
||||||
for _, l := range strings.Split(string(b), "\n") {
|
for _, l := range strings.Split(string(b), "\n") {
|
||||||
|
if !headerDone {
|
||||||
if strings.HasPrefix(l, "HELO:<") {
|
if strings.HasPrefix(l, "HELO:<") {
|
||||||
l = strings.TrimPrefix(l, "HELO:<")
|
l = strings.TrimPrefix(l, "HELO:<")
|
||||||
l = strings.TrimSuffix(l, ">\r")
|
l = strings.TrimSuffix(l, ">\r")
|
||||||
|
@ -184,6 +186,11 @@ func FromBytes(b []byte) *SMTPMessage {
|
||||||
msg.To = append(msg.To, l)
|
msg.To = append(msg.To, l)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if strings.TrimSpace(l) == "" {
|
||||||
|
headerDone = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
msg.Data += l + "\n"
|
msg.Data += l + "\n"
|
||||||
}
|
}
|
||||||
return msg
|
return msg
|
||||||
|
|
6
vendor/github.com/mailhog/storage/maildir.go
generated
vendored
6
vendor/github.com/mailhog/storage/maildir.go
generated
vendored
|
@ -85,7 +85,7 @@ func (maildir *Maildir) Search(kind, query string, start, limit int) (*data.Mess
|
||||||
switch kind {
|
switch kind {
|
||||||
case "to":
|
case "to":
|
||||||
for _, t := range msg.To {
|
for _, t := range msg.To {
|
||||||
if strings.Contains(t.Mailbox+"@"+t.Domain, query) {
|
if strings.Contains(strings.ToLower(t.Mailbox+"@"+t.Domain), query) {
|
||||||
if start > matched {
|
if start > matched {
|
||||||
matched++
|
matched++
|
||||||
break
|
break
|
||||||
|
@ -95,7 +95,7 @@ func (maildir *Maildir) Search(kind, query string, start, limit int) (*data.Mess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "from":
|
case "from":
|
||||||
if strings.Contains(msg.From.Mailbox+"@"+msg.From.Domain, query) {
|
if strings.Contains(strings.ToLower(msg.From.Mailbox+"@"+msg.From.Domain), query) {
|
||||||
if start > matched {
|
if start > matched {
|
||||||
matched++
|
matched++
|
||||||
break
|
break
|
||||||
|
@ -103,7 +103,7 @@ func (maildir *Maildir) Search(kind, query string, start, limit int) (*data.Mess
|
||||||
filteredMessages = append(filteredMessages, *msg)
|
filteredMessages = append(filteredMessages, *msg)
|
||||||
}
|
}
|
||||||
case "containing":
|
case "containing":
|
||||||
if strings.Contains(msg.Raw.Data, query) {
|
if strings.Contains(strings.ToLower(msg.Raw.Data), query) {
|
||||||
if start > matched {
|
if start > matched {
|
||||||
matched++
|
matched++
|
||||||
break
|
break
|
||||||
|
|
2
vendor/github.com/mailhog/storage/mongodb.go
generated
vendored
2
vendor/github.com/mailhog/storage/mongodb.go
generated
vendored
|
@ -1,10 +1,10 @@
|
||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"github.com/mailhog/data"
|
"github.com/mailhog/data"
|
||||||
"gopkg.in/mgo.v2"
|
"gopkg.in/mgo.v2"
|
||||||
"gopkg.in/mgo.v2/bson"
|
"gopkg.in/mgo.v2/bson"
|
||||||
"log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MongoDB represents MongoDB backed storage backend
|
// MongoDB represents MongoDB backed storage backend
|
||||||
|
|
12
vendor/vendor.json
vendored
12
vendor/vendor.json
vendored
|
@ -123,10 +123,10 @@
|
||||||
"revisionTime": "2017-04-16T18:44:30Z"
|
"revisionTime": "2017-04-16T18:44:30Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "ZhN2RVIK/L9LO9WGjducyi2buIk=",
|
"checksumSHA1": "ucMoXRa6ccPO5FyBzhey+N+IOsA=",
|
||||||
"path": "github.com/mailhog/data",
|
"path": "github.com/mailhog/data",
|
||||||
"revision": "98fee9be8f0ca761ad40016ff0dfb4e4d81e2aa8",
|
"revision": "024d554958b5bea5db220bfd84922a584d878ded",
|
||||||
"revisionTime": "2016-08-10T07:45:39Z"
|
"revisionTime": "2017-04-16T19:13:44Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "vyMXU+/pSliAx1yRf6YdKRhF9Ik=",
|
"checksumSHA1": "vyMXU+/pSliAx1yRf6YdKRhF9Ik=",
|
||||||
|
@ -147,10 +147,10 @@
|
||||||
"revisionTime": "2016-11-19T23:01:07Z"
|
"revisionTime": "2016-11-19T23:01:07Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "VFMqtv5B8sXJR50Rwn21jjJZw3E=",
|
"checksumSHA1": "Kd53/4cZ1KNfatXBgCg4VWzowis=",
|
||||||
"path": "github.com/mailhog/storage",
|
"path": "github.com/mailhog/storage",
|
||||||
"revision": "426662792547f066565458d62f52cb05fabc5535",
|
"revision": "970ad63c574405c1d31aade44081611047343c77",
|
||||||
"revisionTime": "2016-11-15T21:39:50Z"
|
"revisionTime": "2017-04-16T18:53:22Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "mbhJnsNwGAwkTQH5c2hVRO9YmxA=",
|
"checksumSHA1": "mbhJnsNwGAwkTQH5c2hVRO9YmxA=",
|
||||||
|
|
Loading…
Reference in a new issue