forked from mbk-lab/rui_orig
2
0
Fork 0

Update resources.go

This commit is contained in:
Alexei Anoshenko 2023-04-20 09:16:16 +03:00
parent 644ec6d8c5
commit 62910bf41f
1 changed files with 3 additions and 3 deletions

View File

@ -123,7 +123,7 @@ func scanEmbedImagesDir(fs *embed.FS, dir, prefix string) {
} else { } else {
ext := strings.ToLower(filepath.Ext(name)) ext := strings.ToLower(filepath.Ext(name))
switch ext { switch ext {
case ".png", ".jpg", ".jpeg", ".svg", ".gif", ".bmp": case ".png", ".jpg", ".jpeg", ".svg", ".gif", ".bmp", ".webp":
registerImage(fs, path, prefix+name) registerImage(fs, path, prefix+name)
} }
} }
@ -272,8 +272,8 @@ func serveResourceFile(filename string, w http.ResponseWriter, r *http.Request)
if serveEmbed(fs, dir+"/"+filename) { if serveEmbed(fs, dir+"/"+filename) {
return true return true
} }
if subdirs, err := fs.ReadDir(dir); err == nil { if subDirs, err := fs.ReadDir(dir); err == nil {
for _, subdir := range subdirs { for _, subdir := range subDirs {
if subdir.IsDir() { if subdir.IsDir() {
if serveEmbed(fs, dir+"/"+subdir.Name()+"/"+filename) { if serveEmbed(fs, dir+"/"+subdir.Name()+"/"+filename) {
return true return true