MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / decodeMIMEHeader

Function decodeMIMEHeader

internal/relay/server.go:773–782  ·  view source on GitHub ↗

decodeMIMEHeader decodes any RFC 2047 encoded-word runs in a header value (e.g. `=?utf-8?Q?caf=C3=A9?=` → `café`). Used for display fields like Subject so downstream consumers (DB, list summaries, dashboard) see the UTF-8 form instead of the wire-encoded form. If decoding fails the original value is

(v string)

Source from the content-addressed store, hash-verified

771// UTF-8 form instead of the wire-encoded form. If decoding fails the original
772// value is returned — preserving the field is better than dropping it.
773func decodeMIMEHeader(v string) string {
774 if v == "" {
775 return v
776 }
777 decoded, err := (&mime.WordDecoder{}).DecodeHeader(v)
778 if err != nil {
779 return v
780 }
781 return decoded
782}
783
784// extractAddressList parses an RFC 5322 address-list header (To/Cc) into bare
785// email addresses, dropping display names. Returns nil if the header is empty

Callers 1

extractThreadInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected