rebuilt template lookup to use a configured template directory before the builtins

This commit is contained in:
2025-09-17 12:23:33 -06:00
parent 9e5a24e03d
commit 9345e95b12
5 changed files with 20 additions and 40 deletions
+2 -1
View File
@@ -15,6 +15,7 @@ import (
"fmt"
"mime"
"net/http"
"path/filepath"
"strings"
)
@@ -44,7 +45,7 @@ func AmServeImage(ctxt AmContext) (string, any, error) {
var err error = nil
if len(components) == 4 && components[2] == "builtin/" {
var b []byte
b, err = static_images.ReadFile(fmt.Sprintf("static_images/%s", components[3]))
b, err = static_images.ReadFile(filepath.Join("static_images", components[3]))
if err == nil {
ctxt.SetOutputType(mimeTypeFromFilename(components[3]))
return "bytes", b, nil