mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-25 19:54:06 +03:00
Specify mimetype for email attachments
This fixes that some email client might not allow previewing the qrcode image.
This commit is contained in:
parent
2fdafd34ca
commit
9cb4c26ac5
4 changed files with 5 additions and 4 deletions
|
@ -547,14 +547,14 @@ func EmailClient(db store.IStore, mailer emailer.Emailer, emailSubject, emailCon
|
|||
globalSettings, _ := db.GetGlobalSettings()
|
||||
config := util.BuildClientConfig(*clientData.Client, server, globalSettings)
|
||||
|
||||
cfgAtt := emailer.Attachment{Name: "wg0.conf", Data: []byte(config)}
|
||||
cfgAtt := emailer.Attachment{Name: "wg0.conf", Data: []byte(config), MimeType: "text/conf"}
|
||||
var attachments []emailer.Attachment
|
||||
if clientData.Client.PrivateKey != "" {
|
||||
qrdata, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(clientData.QRCode, "data:image/png;base64,"))
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "decoding: " + err.Error()})
|
||||
}
|
||||
qrAtt := emailer.Attachment{Name: "wg.png", Data: qrdata}
|
||||
qrAtt := emailer.Attachment{Name: "wg.png", Data: qrdata, MimeType: "image/png"}
|
||||
attachments = []emailer.Attachment{cfgAtt, qrAtt}
|
||||
} else {
|
||||
attachments = []emailer.Attachment{cfgAtt}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue