fix var imgs
This commit is contained in:
parent
011e63dfa1
commit
e46acea3f1
@ -79,7 +79,15 @@ func RenderImage(content string) template.HTML {
|
||||
if err != nil {
|
||||
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, strings.Replace(res.Image, "http", "https", 1)))
|
||||
imgURL := res.Image
|
||||
if strings.HasPrefix(imgURL, "http://") {
|
||||
imgURL = strings.Replace(imgURL, "http://", "https://", 1)
|
||||
}
|
||||
builder.WriteString(
|
||||
fmt.Sprintf(`<td style="color:#9a9aaf;font-size:20px;font-style:normal;font-weight:400;line-height:normal">
|
||||
%s<br> <img class="image" style="width:100%%; max-width:250px; max-height:250px;" src="%s" alt="%s"/></td>`,
|
||||
res.Description, imgURL, res.Description))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,10 +62,10 @@ func TestProcessMessageToSMTP(t *testing.T) {
|
||||
Messenger: "test_messenger",
|
||||
},
|
||||
AllAnswers: []model.ResultAnswer{
|
||||
{AnswerID: 1, QuestionID: 1, Content: "https://www.google.com/search?sca_esv=c51a80de1a7d45f0&sxsrf=ACQVn08xG-a0eH1Vds246-fONoSvvjzVMw:1707762485524&q=ku,n&tbm=isch&source=lnms&sa=X&ved=2ahUKEwi7ub2Ct6aEAxVVb_UHHQIQBVoQ0pQJegQIDRAB&biw=1536&bih=703&dpr=1.25#imgrc=0PWwTuuH2uBQ3M|html", CreatedAt: time.Now()},
|
||||
{AnswerID: 2, QuestionID: 2, Content: "From a friend", CreatedAt: time.Now()},
|
||||
{AnswerID: 1, QuestionID: 1, Content: "`{\"Image\":\"https://s3.timeweb.cloud/3c580be9-cf31f296-d055-49cf-b39e-30c7959dc17b/squizimages/e0927ded-5c4c-4d45-a5ba-c2e938362ffa/co0sejfg4n3c73d5umd0\",\"Description\":\"Да\"}`", CreatedAt: time.Now()},
|
||||
{AnswerID: 2, QuestionID: 2, Content: "`ыв`,`вв`", CreatedAt: time.Now()},
|
||||
{AnswerID: 3, QuestionID: 3, Content: "From a friend", CreatedAt: time.Now()},
|
||||
{AnswerID: 4, QuestionID: 4, Content: `{"Image":"https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg","Description":"Gekon"}`, CreatedAt: time.Now()},
|
||||
{AnswerID: 4, QuestionID: 4, Content: `{"Image":"static.tildacdn.com/tild6335-6331-4539-a664-376366653534/_problembocom.jpg","Description":"Gekon"}`, CreatedAt: time.Now()},
|
||||
},
|
||||
QuestionsMap: map[uint64]string{
|
||||
1: "?",
|
||||
|
Loading…
Reference in New Issue
Block a user