aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/email/parser.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-12-25 12:07:06 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-12-27 09:09:18 +0100
commit6f03c356200becfa347b8abade66ac74f52c10c9 (patch)
treeb06738f1401e8c9694529f9252a7c355ef0589d4 /pkg/email/parser.go
parent73aba437a774237b1130837b856f3b40b3ec3bf0 (diff)
dashboard/app: extract fixing tags from commits
Support the new scheme of associating fixing commits with bugs. Now we provide a tag along the lines of: Reported-by: <syzbot+a4a91f6fc35e102@syzkaller.appspotmail.com> The tag is supposed to be added to the commit. Then we parse commit logs and extract these tags. The final part on the dashboard is not ready yet, but syz-ci should already parse and send the tags.
Diffstat (limited to 'pkg/email/parser.go')
-rw-r--r--pkg/email/parser.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/pkg/email/parser.go b/pkg/email/parser.go
index c59736a1b..e1787ea9d 100644
--- a/pkg/email/parser.go
+++ b/pkg/email/parser.go
@@ -34,7 +34,7 @@ const commandPrefix = "#syz "
var groupsLinkRe = regexp.MustCompile("\nTo view this discussion on the web visit (https://groups\\.google\\.com/.*?)\\.(?:\r)?\n")
-func Parse(r io.Reader, ownEmail string) (*Email, error) {
+func Parse(r io.Reader, ownEmails []string) (*Email, error) {
msg, err := mail.ReadMessage(r)
if err != nil {
return nil, fmt.Errorf("failed to read email: %v", err)
@@ -52,13 +52,17 @@ func Parse(r io.Reader, ownEmail string) (*Email, error) {
cc, _ := msg.Header.AddressList("Cc")
bugID := ""
var ccList []string
- if addr, err := mail.ParseAddress(ownEmail); err == nil {
- ownEmail = addr.Address
+ ownAddrs := make(map[string]bool)
+ for _, email := range ownEmails {
+ ownAddrs[email] = true
+ if addr, err := mail.ParseAddress(email); err == nil {
+ ownAddrs[addr.Address] = true
+ }
}
fromMe := false
for _, addr := range from {
cleaned, _, _ := RemoveAddrContext(addr.Address)
- if addr, err := mail.ParseAddress(cleaned); err == nil && addr.Address == ownEmail {
+ if addr, err := mail.ParseAddress(cleaned); err == nil && ownAddrs[addr.Address] {
fromMe = true
}
}
@@ -67,7 +71,7 @@ func Parse(r io.Reader, ownEmail string) (*Email, error) {
if addr, err := mail.ParseAddress(cleaned); err == nil {
cleaned = addr.Address
}
- if cleaned == ownEmail {
+ if ownAddrs[cleaned] {
if bugID == "" {
bugID = context
}