mirror of
https://github.com/acepanel/panel.git
synced 2026-02-07 04:40:57 +08:00
feat: 规范统一使用 422 状态码
This commit is contained in:
@@ -143,12 +143,12 @@ func (c *Fail2banController) List(ctx http.Context) http.Response {
|
||||
limit := ctx.Request().QueryInt("limit", 10)
|
||||
raw := tools.Read("/etc/fail2ban/jail.local")
|
||||
if len(raw) == 0 {
|
||||
return controllers.Error(ctx, http.StatusBadRequest, "Fail2ban 规则为空")
|
||||
return controllers.Error(ctx, http.StatusUnprocessableEntity, "Fail2ban 规则为空")
|
||||
}
|
||||
|
||||
jailList := regexp.MustCompile(`\[(.*?)]`).FindAllStringSubmatch(raw, -1)
|
||||
if len(jailList) == 0 {
|
||||
return controllers.Error(ctx, http.StatusBadRequest, "Fail2ban 规则为空")
|
||||
return controllers.Error(ctx, http.StatusUnprocessableEntity, "Fail2ban 规则为空")
|
||||
}
|
||||
|
||||
var jails []Jail
|
||||
|
||||
Reference in New Issue
Block a user