From c45ffda6eb5f4df3caa0d1c02a4107b16cbf8ad6 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 15 Dec 2022 15:30:25 +0800 Subject: [PATCH] fix-3392 --- routers/api/v1/repo/cloudbrain.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index e5cfbc86c..ca4a8c747 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -766,13 +766,17 @@ func CloudbrainGetLog(ctx *context.APIContext) { if baseLine == "" && order == "desc" && result["Lines"].(int) == 0 { result["Lines"] = 1 result["EndLine"] = 1 + content = content + ctx.Data["existStr"].(string) } - if ctx.Data["existStr"] != nil && result["Lines"].(int) < 60 { + + if result["Lines"].(int) == 0 && result["StartLine"] == result["EndLine"] && result["StartLine"].(int) != 0 { content = content + ctx.Data["existStr"].(string) - if result["Lines"].(int) == 0 { - result["Lines"] = 1 - result["EndLine"] = result["StartLine"] - } + result["Lines"] = 1 + result["StartLine"] = result["StartLine"].(int) - 1 + } + if result["Lines"].(int) == 1 && result["StartLine"] == result["EndLine"] { + result["Lines"] = 0 + result["StartLine"] = result["StartLine"].(int) + 1 } } } else {