From d62d0aa11c0d931b3737bf9bf241b01aea2f971d Mon Sep 17 00:00:00 2001 From: naiba Date: Fri, 29 Nov 2024 22:49:17 +0800 Subject: [PATCH] fix: home page 500 --- .github/workflows/release.yml | 2 -- cmd/dashboard/controller/controller.go | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6777269..94e4036 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,8 +70,6 @@ jobs: - name: generate swagger docs run: | go install github.com/swaggo/swag/cmd/swag@latest - touch ./cmd/dashboard/user-dist/a - touch ./cmd/dashboard/admin-dist/a swag init --pd -d . -g ./cmd/dashboard/main.go -o ./cmd/dashboard/docs --parseGoList=false - name: Build with tag diff --git a/cmd/dashboard/controller/controller.go b/cmd/dashboard/controller/controller.go index d354723..de60bb3 100644 --- a/cmd/dashboard/controller/controller.go +++ b/cmd/dashboard/controller/controller.go @@ -226,6 +226,9 @@ func fallbackToFrontend(adminFrontend, userFrontend fs.FS) func(*gin.Context) { if err != nil { return false } + if fileStat.IsDir() { + return false + } http.ServeContent(c.Writer, c.Request, path, fileStat.ModTime(), f.(io.ReadSeeker)) return true }