diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-12-26 11:56:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-26 11:56:03 +0800 |
commit | 9bfa9f450da509bf61c6c762bcb1dc1d6c9bd0bd (patch) | |
tree | 559615153f1580e4f63cc51a99db419ec06b74e3 /routers | |
parent | 594edad213c2963edfdb6582663a9396ad43a9c0 (diff) | |
download | gitea-9bfa9f450da509bf61c6c762bcb1dc1d6c9bd0bd.tar.gz gitea-9bfa9f450da509bf61c6c762bcb1dc1d6c9bd0bd.zip |
Refactor "string truncate" (#32984)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/actions/runner/runner.go | 2 | ||||
-rw-r--r-- | routers/web/repo/compare.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/actions/runner/runner.go b/routers/api/actions/runner/runner.go index 8f365cc926..c55b30f7eb 100644 --- a/routers/api/actions/runner/runner.go +++ b/routers/api/actions/runner/runner.go @@ -69,7 +69,7 @@ func (s *Service) Register( labels := req.Msg.Labels // create new runner - name, _ := util.SplitStringAtByteN(req.Msg.Name, 255) + name := util.EllipsisDisplayString(req.Msg.Name, 255) runner := &actions_model.ActionRunner{ UUID: gouuid.New().String(), Name: name, diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index 8c4003690a..b3c1eb7cb0 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -664,7 +664,7 @@ func PrepareCompareDiff( } if len(title) > 255 { var trailer string - title, trailer = util.SplitStringAtByteN(title, 255) + title, trailer = util.EllipsisDisplayStringX(title, 255) if len(trailer) > 0 { if ctx.Data["content"] != nil { ctx.Data["content"] = fmt.Sprintf("%s\n\n%s", trailer, ctx.Data["content"]) |