diff --git a/handlers.go b/handlers.go index 13ffd2b..492a21e 100644 --- a/handlers.go +++ b/handlers.go @@ -332,8 +332,6 @@ func index(w http.ResponseWriter, r *http.Request) { template.New("").Funcs(templateFuncs).ParseFS(templates, "templates/main.html"), ) - //tmpl = tmpl.Funcs(templateFuncs) - err = tmpl.ExecuteTemplate(w, "main.html", stuff) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/main.go b/main.go index 757e785..e8f7f10 100644 --- a/main.go +++ b/main.go @@ -158,12 +158,17 @@ func main() { log.Println(err) continue } - defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) if err != nil { log.Println(err) continue } + err = resp.Body.Close() + if err != nil { + log.Println(err) + continue + } contentType := resp.Header.Get("Content-Type") err = app.queries.AddIcon(app.ctx, data.AddIconParams{ diff --git a/templates/main.html b/templates/main.html index 13a7e6f..762a47d 100644 --- a/templates/main.html +++ b/templates/main.html @@ -1,6 +1,9 @@