From 57782aba5ff9a4564a44d2dc7b563507c36d5221 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Thu, 1 Jun 2023 21:18:48 -0500 Subject: [PATCH] Fix dataimg path bug --- src/templates/templates.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/templates/templates.go b/src/templates/templates.go index 763c038..4d03762 100644 --- a/src/templates/templates.go +++ b/src/templates/templates.go @@ -8,6 +8,7 @@ import ( "io" "io/fs" "net/http" + "path/filepath" "regexp" "strings" "time" @@ -111,15 +112,16 @@ func names(ts []*template.Template) []string { //go:embed img/* var Imgs embed.FS -func GetImg(filepath string) []byte { +func GetImg(file string) []byte { var imgs fs.FS if config.Config.DevConfig.LiveTemplates { imgs = utils.DirFS("src/templates/img") } else { imgs = Imgs + file = filepath.Join("img/", file) } - img, err := imgs.Open(filepath) + img, err := imgs.Open(file) if err != nil { panic(err) }