replace http to https in mail download
All checks were successful
Deploy / CreateImage (push) Successful in 2m17s
Deploy / DeployService (push) Successful in 25s

This commit is contained in:
skeris 2025-04-03 00:58:43 +03:00
parent 1a7a15f478
commit cad6445b4e
2 changed files with 6 additions and 4 deletions

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

Binary file not shown.