upgrade deps; rewrite smtp session
This commit is contained in:
3
vendor/github.com/jhillyerd/enmime/internal/coding/charsets.go
generated
vendored
3
vendor/github.com/jhillyerd/enmime/internal/coding/charsets.go
generated
vendored
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -307,7 +306,7 @@ func ConvertToUTF8String(charset string, textBytes []byte) (string, error) {
|
||||
}
|
||||
input := bytes.NewReader(textBytes)
|
||||
reader := transform.NewReader(input, csentry.e.NewDecoder())
|
||||
output, err := ioutil.ReadAll(reader)
|
||||
output, err := io.ReadAll(reader)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
14
vendor/github.com/jhillyerd/enmime/internal/coding/headerext.go
generated
vendored
14
vendor/github.com/jhillyerd/enmime/internal/coding/headerext.go
generated
vendored
@@ -54,20 +54,20 @@ func RFC2047Decode(s string) string {
|
||||
|
||||
default:
|
||||
if decoded {
|
||||
keyValuePair := strings.SplitAfter(s, "=")
|
||||
if len(keyValuePair) < 2 {
|
||||
key, value, found := strings.Cut(s, "=")
|
||||
if !found {
|
||||
return s
|
||||
}
|
||||
|
||||
// Add quotes as needed.
|
||||
if !strings.HasPrefix(keyValuePair[1], "\"") {
|
||||
keyValuePair[1] = fmt.Sprintf("\"%s", keyValuePair[1])
|
||||
if !strings.HasPrefix(value, "\"") {
|
||||
value = fmt.Sprintf("\"%s", value)
|
||||
}
|
||||
if !strings.HasSuffix(keyValuePair[1], "\"") {
|
||||
keyValuePair[1] = fmt.Sprintf("%s\"", keyValuePair[1])
|
||||
if !strings.HasSuffix(value, "\"") {
|
||||
value = fmt.Sprintf("%s\"", value)
|
||||
}
|
||||
|
||||
return strings.Join(keyValuePair, "")
|
||||
return fmt.Sprintf("%s=%s", key, value)
|
||||
}
|
||||
|
||||
return s
|
||||
|
||||
Reference in New Issue
Block a user