🚨 fix warnings [no ci]

This commit is contained in:
naiba 2022-06-23 22:56:34 +08:00
parent 220e698d3b
commit cbef1fcf8a
2 changed files with 4 additions and 4 deletions

View File

@ -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),

View File

@ -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
}