BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr
Handling the situation where the scan log does not exist
lotk468152fb9e61
diff --git a/core/internal/controller/abnormal_recipient/abnormal_recipient_v1_get_scan_log.go b/core/internal/controller/abnormal_recipient/abnormal_recipient_v1_get_scan_log.goindex 9e7d2c56..e596e9b9 100644--- a/core/internal/controller/abnormal_recipient/abnormal_recipient_v1_get_scan_log.go+++ b/core/internal/controller/abnormal_recipient/abnormal_recipient_v1_get_scan_log.go@@ -6,6 +6,7 @@ import ("context""github.com/gogf/gf/v2/errors/gerror""os"+ "strings")func (c *ControllerV1) GetScanLog(ctx context.Context, req *v1.GetScanLogReq) (res *v1.GetScanLogRes, err error) {@@ -15,7 +16,17 @@ func (c *ControllerV1) GetScanLog(ctx context.Context, req *v1.GetScanLogReq) (rcontent, err := os.ReadFile(logDir)if err != nil {+ if os.IsNotExist(err) {+ res.Data = ""+ res.SetSuccess(public.LangCtx(ctx, "Success"))+ return+ }+ if strings.Contains(err.Error(), "no such file or directory") {+ res.Data = ""+ res.SetSuccess(public.LangCtx(ctx, "Success"))+ return+ }res.SetError(gerror.New(public.LangCtx(ctx, "Failed to read log file: : {}", err.Error())))return}