Merge pull request #16175 from ioito/hotfix/qx-attachment-name

fix(notify): attachment name
This commit is contained in:
Zexi Li
2023-03-08 13:12:57 +08:00
committed by GitHub

View File

@@ -17,7 +17,9 @@ package sender
import (
"crypto/tls"
"encoding/base64"
"fmt"
"io"
"mime"
"net/http"
"net/url"
"time"
@@ -90,6 +92,11 @@ func (emailSender *SEmailSender) Send(args api.SendParams) error {
_, err := w.Write([]byte("Content-Type: " + attach.Mime))
return errors.Wrap(err, "WriteMime")
}),
gomail.SetHeader(map[string][]string{
"Content-Disposition": {
fmt.Sprintf(`attachment; filename="%s"`, mime.QEncoding.Encode("UTF-8", attach.Filename)),
},
}),
gomail.SetCopyFunc(func(w io.Writer) error {
contBytes, err := base64.StdEncoding.DecodeString(attach.Base64Content)
if err != nil {