aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-12-26 11:56:03 +0800
committerGitHub <noreply@github.com>2024-12-26 11:56:03 +0800
commit9bfa9f450da509bf61c6c762bcb1dc1d6c9bd0bd (patch)
tree559615153f1580e4f63cc51a99db419ec06b74e3 /routers
parent594edad213c2963edfdb6582663a9396ad43a9c0 (diff)
downloadgitea-9bfa9f450da509bf61c6c762bcb1dc1d6c9bd0bd.tar.gz
gitea-9bfa9f450da509bf61c6c762bcb1dc1d6c9bd0bd.zip
Refactor "string truncate" (#32984)
Diffstat (limited to 'routers')
-rw-r--r--routers/api/actions/runner/runner.go2
-rw-r--r--routers/web/repo/compare.go2
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"])