fix embed handling

This commit is contained in:
orangix
2026-01-19 17:24:40 +01:00
parent 189ebeefde
commit 04fbc7f5f4
2 changed files with 2 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ func main() {
render.Initialize(views)
app := http.NewServeMux()
app.Handle("/static/", http.FileServerFS(static))
app.Handle("/static/", http.StripPrefix("/static/", http.FileServerFS(static)))
app.Handle("GET /test-render", wrapHandler(func(w http.ResponseWriter, r *http.Request) error {
err := render.Render(w, "errors/404", nil)
fmt.Println(err)

View File

@@ -28,11 +28,10 @@ func Initialize(views fs.FS) {
r := new(renderer)
r.templates = make(map[string]*raymond.Template)
r.registerHelpers()
fs.WalkDir(views, "/", func(path string, d fs.DirEntry, err error) error {
fs.WalkDir(views, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil || d.IsDir() {
return err
}
path, _ = filepath.Rel("/", path)
name, hasExt := strings.CutSuffix(path, ext)
if !hasExt {
return nil