From d09e693035b22c58bee0a52b79999a24b03fe95f Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Thu, 5 Mar 2026 14:32:06 -0700 Subject: [PATCH] we don't want to use filepath on embedded filesystems --- ui/images.go | 5 ++--- ui/static.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/images.go b/ui/images.go index 3491517..a90fef7 100644 --- a/ui/images.go +++ b/ui/images.go @@ -22,7 +22,6 @@ import ( "mime" "mime/multipart" "net/http" - "path/filepath" "strconv" "strings" @@ -70,13 +69,13 @@ func AmServeImage(c echo.Context) error { switch components[2] { case "builtin/": var b []byte - b, err = static_images.ReadFile(filepath.Join("static_images", components[3])) + b, err = static_images.ReadFile(fmt.Sprintf("static_images/%s", components[3])) if err == nil { return c.Blob(http.StatusOK, mimeTypeFromFilename(components[3]), b) } case "ads/": var b []byte - b, err = ad_banners.ReadFile(filepath.Join("adbanners", components[3])) + b, err = ad_banners.ReadFile(fmt.Sprintf("adbanners/%s", components[3])) if err == nil { return c.Blob(http.StatusOK, mimeTypeFromFilename(components[3]), b) } diff --git a/ui/static.go b/ui/static.go index 7683d5e..a37a9b9 100644 --- a/ui/static.go +++ b/ui/static.go @@ -13,11 +13,11 @@ package ui import ( "bytes" "embed" + "fmt" "io" "io/fs" "net/http" "os" - "path/filepath" "strings" "git.erbosoft.com/amy/amsterdam/config" @@ -133,7 +133,7 @@ func AmLoadHTMLResource(resourceName string) (string, string, error) { } } if f == nil { - f, err = static_resources.Open(filepath.Join("resources", resourceName)) + f, err = static_resources.Open(fmt.Sprintf("resources/%s", resourceName)) if err != nil { return "", "", err }