cmd/sgblog-comment-add/mail.go | 11 ++++++++++- diff --git a/cmd/sgblog-comment-add/mail.go b/cmd/sgblog-comment-add/mail.go index 2af066a81350b540e47524e04461a611b16cbf3aa50c29b2e4aa4bd56ccefdb8..4dec5331e9dce6aef17339f716782cc4d6cd470dfd633ff6609213b141e62cd0 100644 --- a/cmd/sgblog-comment-add/mail.go +++ b/cmd/sgblog-comment-add/mail.go @@ -21,6 +21,7 @@ import ( "bytes" "encoding/base64" "errors" + "fmt" "io" "mime" "mime/multipart" @@ -74,6 +75,10 @@ body, err = processTP(ct, msg.Header.Get(CTE), msg.Body) return } ct, params, err := mime.ParseMediaType(ct) + if err != nil { + err = fmt.Errorf("can not ParseMediaType: %w", err) + return + } if ct != "multipart/signed" { err = errors.New("only text/plain and multipart/signed+text/plain Content-Type supported") return @@ -108,7 +113,11 @@ body, err = processTP(ct, part.Header.Get(CTE), part) return } if strings.HasPrefix(ct, "multipart/mixed") { - ct, params, err = mime.ParseMediaType(ct) + _, params, err = mime.ParseMediaType(ct) + if err != nil { + err = fmt.Errorf("can not ParseMediaType: %w", err) + return + } boundary = params["boundary"] if len(boundary) == 0 { err = errors.New("no boundary string")