replace http to https in mail download
This commit is contained in:
parent
1a7a15f478
commit
cad6445b4e
@ -84,12 +84,14 @@ func RenderImage(content string) template.HTML {
|
||||
cnt = strings.TrimSuffix(cnt, "`")
|
||||
}
|
||||
|
||||
fmt.Println("RI1", cnt)
|
||||
var res model.ImageContent
|
||||
err := json.Unmarshal([]byte(cnt), &res)
|
||||
if err != nil {
|
||||
fmt.Println("RI1", content)
|
||||
return SplitContent(content)
|
||||
} else {
|
||||
builder.WriteString(fmt.Sprintf("<td>%s<br><img class=\"image\" style=\"width:100%%; max-width:250px; max-height:250px\" src=\"%s\"/></td>", res.Description, res.Image))
|
||||
builder.WriteString(fmt.Sprintf("<td>%s<br><img class=\"image\" style=\"width:100%%; max-width:250px; max-height:250px\" src=\"%s\"/></td>", res.Description, strings.Replace(res.Image,"http","https",1)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,9 +103,9 @@ func SplitContent(content string) template.HTML {
|
||||
if len(parts) == 2 {
|
||||
url := strings.TrimSpace(parts[0])
|
||||
filename := strings.TrimSpace(parts[1])
|
||||
return template.HTML(fmt.Sprintf(`<a href="%s" download>%s</a>`, url, filename))
|
||||
return template.HTML(fmt.Sprintf(`<a href="%s" download>%s</a>`, strings.Replace(url,"http","https",1), filename))
|
||||
}
|
||||
return template.HTML(content)
|
||||
return template.HTML(strings.ReplaceAll(strings.ReplaceAll(content,"`,`","<br>"),"`",""))
|
||||
}
|
||||
|
||||
func sanitizeHTMLData(data EmailTemplateData) EmailTemplateData {
|
||||
|
BIN
worker
Executable file
BIN
worker
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user