From d2fce5a87622b4e75ddee8d37f7303b381c5b6ba Mon Sep 17 00:00:00 2001 From: Chandler Swift Date: Mon, 18 Oct 2021 17:56:43 -0500 Subject: [PATCH] Fix screenshot URLs --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 86c6987..db65f50 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,7 @@ done */ import ( + "encoding/base64" "flag" "fmt" "html/template" @@ -42,7 +43,7 @@ type HatsSite struct { DomainName string Owner string Since time.Time - ScreenshotURL string + ScreenshotURL template.URL Title string FetchTime time.Time HTTPOpen bool @@ -71,7 +72,7 @@ func getSites(largest int, wd selenium.WebDriver) (sites []HatsSite, err error) sites = append(sites, HatsSite{ DomainName: domainName, Owner: "unknown", - ScreenshotURL: string(screenshot), + ScreenshotURL: template.URL(fmt.Sprintf("data:image/png;base64,%v", base64.StdEncoding.EncodeToString(screenshot))), Title: title, FetchTime: time.Now(), HTTPOpen: false, // TODO