use embed.fs wrapper on data

This commit is contained in:
Harvey Tindall
2021-02-02 15:44:30 +00:00
parent e6775cd2d1
commit aaed272bf2
4 changed files with 19 additions and 16 deletions

View File

@@ -14,12 +14,12 @@ type httpFS struct {
}
func (f httpFS) Open(name string) (http.File, error) {
return f.hfs.Open("data/web" + name)
return f.hfs.Open("web" + name)
}
func (f httpFS) Exists(prefix string, filepath string) bool {
if p := strings.TrimPrefix(filepath, prefix); len(p) < len(filepath) {
stats, err := fs.Stat(f.fs, "data/web/"+p)
stats, err := fs.Stat(f.fs, "web/"+p)
if err != nil {
return false
}