mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-17 10:10:08 +00:00
pkg/email: handle emails without Content-Type header
git-send-email sends emails without Content-Type, let's assume it's text.
This commit is contained in:
parent
9a6ff11ff9
commit
866f1102f7
@ -246,9 +246,14 @@ func extractArgsLine(body []byte) string {
|
||||
}
|
||||
|
||||
func parseBody(r io.Reader, headers mail.Header) (body []byte, attachments [][]byte, err error) {
|
||||
mediaType, params, err := mime.ParseMediaType(headers.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to parse email header 'Content-Type': %v", err)
|
||||
// git-send-email sends emails without Content-Type, let's assume it's text.
|
||||
mediaType := "text/plain"
|
||||
var params map[string]string
|
||||
if contentType := headers.Get("Content-Type"); contentType != "" {
|
||||
mediaType, params, err = mime.ParseMediaType(headers.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to parse email header 'Content-Type': %v", err)
|
||||
}
|
||||
}
|
||||
// Note: mime package handles quoted-printable internally.
|
||||
if strings.ToLower(headers.Get("Content-Transfer-Encoding")) == "base64" {
|
||||
|
@ -320,7 +320,6 @@ Message-ID: <123>
|
||||
Subject: test subject
|
||||
From: Bob <bob@example.com>
|
||||
To: syzbot <bot@example.com>, Alice <alice@example.com>
|
||||
Content-Type: text/plain
|
||||
|
||||
#syz invalid
|
||||
text body
|
||||
|
Loading…
x
Reference in New Issue
Block a user