Skip to content

Commit

Permalink
SMTP: Adding contentType and contentType params to metadata output
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Hinderberger committed Jul 2, 2024
1 parent deee3f5 commit 12fd66c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/smtp/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,18 @@ func (h *smtpHTTPHandler) handleMultipartMeta(
}

func buildContentMeta(c *ReceivedContent) map[string]any {
contentTypeParams := c.ContentTypeParams()
if contentTypeParams == nil {
// Returning an empty map instead of null more closely resembles the semantics
// of contentTypeParams.
contentTypeParams = make(map[string]string)
}

out := map[string]any{
"bodySize": len(c.Body()),
"isMultipart": c.IsMultipart(),
"bodySize": len(c.Body()),
"isMultipart": c.IsMultipart(),
"contentType": c.ContentType(),
"contentTypeParams": contentTypeParams,
}

headers := make(map[string]any)
Expand Down

0 comments on commit 12fd66c

Please sign in to comment.