fix: don't select multipart/alternative if length is 0

This commit is contained in:
James Houlahan
2020-08-11 10:57:08 +02:00
parent 7d1b0d0a40
commit 180c6699e0

View File

@ -250,6 +250,10 @@ func bestChoice(childParts []parser.Parts, preferredContentType string) parser.P
}
func allPartsHaveContentType(parts parser.Parts, contentType string) bool {
if len(parts) == 0 {
return false
}
for _, part := range parts {
t, _, err := part.Header.ContentType()
if err != nil {