Fix reference to mock file templates

This commit is contained in:
Eli Ribble 2026-01-07 18:56:03 +00:00
parent bacd452346
commit ff86a5488e
2 changed files with 2 additions and 2 deletions

View file

@ -76,7 +76,7 @@ func NewBuiltTemplate(embeddedFiles embed.FS, subdir string, files ...string) *B
template: parseEmbedded(embeddedFiles, subdir, files),
}
}
TemplatesByFilename[files[0]] = result
TemplatesByFilename[path.Base(files[0])] = result
return &result
}

View file

@ -239,7 +239,7 @@ func Mock(t string, w http.ResponseWriter, code string) {
SettingUserAdd: "/mock/setting/user/add",
},
}
template, ok := htmlpage.TemplatesByFilename[t]
template, ok := htmlpage.TemplatesByFilename[t+".html"]
if !ok {
log.Error().Str("template", t).Msg("Failed to find template")
respondError(w, "Failed to render template", nil, http.StatusInternalServerError)