upgrade deps; rewrite smtp session

This commit is contained in:
Aine
2024-02-19 22:55:14 +02:00
parent 10213cc7d7
commit a01720da00
277 changed files with 106832 additions and 7641 deletions

View File

@@ -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
}

View File

@@ -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