mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
refactor: don't reconstruct mimeBody
This commit is contained in:
@ -21,13 +21,10 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"mime"
|
||||
"mime/quotedprintable"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"encoding/base64"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/net/html/charset"
|
||||
@ -246,19 +243,6 @@ func DecodeCharset(original []byte, contentType string) ([]byte, error) {
|
||||
return decoded, nil
|
||||
}
|
||||
|
||||
// DecodeContentEncoding wraps the reader with decoder based on content encoding.
|
||||
func DecodeContentEncoding(r io.Reader, contentEncoding string) (d io.Reader) {
|
||||
switch strings.ToLower(contentEncoding) {
|
||||
case "quoted-printable":
|
||||
d = quotedprintable.NewReader(r)
|
||||
case "base64":
|
||||
d = base64.NewDecoder(base64.StdEncoding, r)
|
||||
case "7bit", "8bit", "binary", "": // Nothing to do
|
||||
d = r
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ParseMediaType from MIME doesn't support RFC2231 for non asci / utf8 encodings so we have to pre-parse it.
|
||||
func ParseMediaType(v string) (mediatype string, params map[string]string, err error) {
|
||||
v, _ = changeEncodingAndKeepLastParamDefinition(v)
|
||||
|
||||
Reference in New Issue
Block a user