feat: update fabfile

This commit is contained in:
Rogee
2025-05-06 15:19:38 +08:00
parent 4b08a8199b
commit a2c38833b0
3 changed files with 10 additions and 8 deletions

View File

@@ -133,11 +133,6 @@ func checkStaticFile(rootPath string) func(ctx fiber.Ctx) error {
f = "index.html"
}
ext := filepath.Ext(f)
mime := mime.TypeByExtension(ext)
log.Infof("admin mime type: %s %s", ext, mime)
ctx.Set(fiber.HeaderContentType, mime)
checkFiles := []string{f, "index.html"}
for _, checkFile := range checkFiles {
filePath := filepath.Join(rootPath, checkFile)
@@ -147,6 +142,13 @@ func checkStaticFile(rootPath string) func(ctx fiber.Ctx) error {
log.Warnf("file not found: %s", filePath)
continue
}
ext := filepath.Ext(filePath)
mime := mime.TypeByExtension(ext)
log.Infof("mime type: %s %s", ext, mime)
ctx.Set(fiber.HeaderContentType, mime)
return ctx.SendFile(file)
}
return ctx.SendStatus(fiber.StatusNotFound)