diff --git a/cmd/dashboard/controller/member_api.go b/cmd/dashboard/controller/member_api.go index 0f3702a..a70b4b3 100644 --- a/cmd/dashboard/controller/member_api.go +++ b/cmd/dashboard/controller/member_api.go @@ -724,7 +724,7 @@ func (ma *memberAPI) updateSetting(c *gin.Context) { return } - if yes, err := utils.IsDirEmpty("resource/template/theme-" + sf.Theme); err != nil || yes { + if yes, err := utils.IsTemplateDirEmpty("theme-" + sf.Theme); err != nil || yes { c.JSON(http.StatusOK, model.Response{ Code: http.StatusBadRequest, Message: fmt.Sprintf("前台主题文件异常:%s", err), @@ -732,7 +732,7 @@ func (ma *memberAPI) updateSetting(c *gin.Context) { return } - if yes, err := utils.IsDirEmpty("resource/template/dashboard-" + sf.DashboardTheme); err != nil || yes { + if yes, err := utils.IsTemplateDirEmpty("dashboard-" + sf.DashboardTheme); err != nil || yes { c.JSON(http.StatusOK, model.Response{ Code: http.StatusBadRequest, Message: fmt.Sprintf("后台主题文件异常:%s", err), diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 0293746..87d2e16 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -97,8 +97,8 @@ func SplitIPAddr(v4v6Bundle string) (string, string, string) { return ipv4, ipv6, validIP } -func IsDirEmpty(name string) (bool, error) { - f, err := os.Open(filepath.Join("./", filepath.Clean(name))) +func IsTemplateDirEmpty(name string) (bool, error) { + f, err := os.Open(filepath.Join("resource/template/", filepath.Clean(name))) if err != nil { return false, err }