forked from mbk-lab/rui_orig
Update resources.go
This commit is contained in:
parent
644ec6d8c5
commit
62910bf41f
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue