MCPcopy Create free account
hub / github.com/buggregator/server / decodeContent

Function decodeContent

modules/smtp/handler.go:345–362  ·  view source on GitHub ↗
(data []byte, encoding string)

Source from the content-addressed store, hash-verified

343}
344
345func decodeContent(data []byte, encoding string) []byte {
346 switch strings.ToLower(encoding) {
347 case "base64":
348 decoded, err := base64.StdEncoding.DecodeString(string(data))
349 if err != nil {
350 return data
351 }
352 return decoded
353 case "quoted-printable":
354 decoded, err := io.ReadAll(quotedprintable.NewReader(bytes.NewReader(data)))
355 if err != nil {
356 return data
357 }
358 return decoded
359 default:
360 return data
361 }
362}
363
364// convertToUTF8 converts data from the given charset to UTF-8.
365// If charset is empty, "utf-8", or "us-ascii", the data is returned as-is.

Callers 3

parseEmailFunction · 0.85
processPartFunction · 0.85
TestDecodeContentFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestDecodeContentFunction · 0.68