Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) {
// Remove the trailing slash at the end of setting.AppURL, the request
// URI always contains a leading slash, which would result in a double
// slash
target := strings.TrimRight(setting.AppURL, "/") + r.URL.RequestURI()
target := strings.TrimSuffix(setting.AppURL, "/") + r.URL.RequestURI()
http.Redirect(w, r, target, http.StatusFound)
}

Expand Down
2 changes: 1 addition & 1 deletion models/ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func CheckPublicKeyString(content string) (_ string, err error) {
return "", err
}

content = strings.TrimRight(content, "\n\r")
content = strings.TrimSuffix(content, "\n\r")
if strings.ContainsAny(content, "\n\r") {
return "", errors.New("only a single line with a single key please")
}
Expand Down
2 changes: 1 addition & 1 deletion models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (u *User) generateRandomAvatar(e Engine) error {
// the local explore page. Function returns immediately.
// When applicable, the link is for an avatar of the indicated size (in pixels).
func (u *User) SizedRelAvatarLink(size int) string {
return strings.TrimRight(setting.AppSubURL, "/") + "/user/avatar/" + u.Name + "/" + strconv.Itoa(size)
return strings.TrimSuffix(setting.AppSubURL, "/") + "/user/avatar/" + u.Name + "/" + strconv.Itoa(size)
}

// RealSizedAvatarLink returns a link to the user's avatar. When
Expand Down
2 changes: 1 addition & 1 deletion modules/git/repo_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (repo *Repository) GetTagInfos(page, pageSize int) ([]*Tag, error) {
return nil, err
}

tagNames := strings.Split(strings.TrimRight(stdout, "\n"), "\n")
tagNames := strings.Split(strings.TrimSuffix(stdout, "\n"), "\n")

if page != 0 {
skip := (page - 1) * pageSize
Expand Down
2 changes: 1 addition & 1 deletion modules/git/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ l:
}
nextline += eol + 1
case eol == 0:
tag.Message = strings.TrimRight(string(data[nextline+1:]), "\n")
tag.Message = strings.TrimSuffix(string(data[nextline+1:]), "\n")
break l
default:
break l
Expand Down
2 changes: 1 addition & 1 deletion modules/public/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (opts *Options) staticHandler(dir string) macaron.Handler {
opts.Prefix = "/" + opts.Prefix
}
// Remove any trailing '/'
opts.Prefix = strings.TrimRight(opts.Prefix, "/")
opts.Prefix = strings.TrimSuffix(opts.Prefix, "/")
}
if opts.FileSystem == nil {
opts.FileSystem = newStaticFileSystem(dir)
Expand Down
4 changes: 2 additions & 2 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,8 @@ func NewContext() {
newMarkup()

sec = Cfg.Section("U2F")
U2F.TrustedFacets, _ = shellquote.Split(sec.Key("TRUSTED_FACETS").MustString(strings.TrimRight(AppURL, "/")))
U2F.AppID = sec.Key("APP_ID").MustString(strings.TrimRight(AppURL, "/"))
U2F.TrustedFacets, _ = shellquote.Split(sec.Key("TRUSTED_FACETS").MustString(strings.TrimSuffix(AppURL, "/")))
U2F.AppID = sec.Key("APP_ID").MustString(strings.TrimSuffix(AppURL, "/"))

UI.ReactionsMap = make(map[string]bool)
for _, reaction := range UI.Reactions {
Expand Down
2 changes: 1 addition & 1 deletion modules/webhook/dingtalk.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (d *DingtalkPayload) Push(p *api.PushPayload) (api.Payloader, error) {
authorName = " - " + commit.Author.Name
}
text += fmt.Sprintf("[%s](%s) %s", commit.ID[:7], commit.URL,
strings.TrimRight(commit.Message, "\r\n")) + authorName
strings.TrimSuffix(commit.Message, "\r\n")) + authorName
// add linebreak to each commit but the last
if i < len(p.Commits)-1 {
text += "\n"
Expand Down
2 changes: 1 addition & 1 deletion modules/webhook/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (d *DiscordPayload) Push(p *api.PushPayload) (api.Payloader, error) {
// for each commit, generate attachment text
for i, commit := range p.Commits {
text += fmt.Sprintf("[%s](%s) %s - %s", commit.ID[:7], commit.URL,
strings.TrimRight(commit.Message, "\r\n"), commit.Author.Name)
strings.TrimSuffix(commit.Message, "\r\n"), commit.Author.Name)
// add linebreak to each commit but the last
if i < len(p.Commits)-1 {
text += "\n"
Expand Down
2 changes: 1 addition & 1 deletion modules/webhook/feishu.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (f *FeishuPayload) Push(p *api.PushPayload) (api.Payloader, error) {
authorName = " - " + commit.Author.Name
}
text += fmt.Sprintf("[%s](%s) %s", commit.ID[:7], commit.URL,
strings.TrimRight(commit.Message, "\r\n")) + authorName
strings.TrimSuffix(commit.Message, "\r\n")) + authorName
// add linebreak to each commit but the last
if i < len(p.Commits)-1 {
text += "\n"
Expand Down
2 changes: 1 addition & 1 deletion modules/webhook/msteams.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func (m *MSTeamsPayload) Push(p *api.PushPayload) (api.Payloader, error) {
// for each commit, generate attachment text
for i, commit := range p.Commits {
text += fmt.Sprintf("[%s](%s) %s - %s", commit.ID[:7], commit.URL,
strings.TrimRight(commit.Message, "\r\n"), commit.Author.Name)
strings.TrimSuffix(commit.Message, "\r\n"), commit.Author.Name)
// add linebreak to each commit but the last
if i < len(p.Commits)-1 {
text += "\n"
Expand Down
2 changes: 1 addition & 1 deletion modules/webhook/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (t *TelegramPayload) Push(p *api.PushPayload) (api.Payloader, error) {
authorName = " - " + commit.Author.Name
}
text += fmt.Sprintf(`[<a href="%s">%s</a>] %s`, commit.URL, commit.ID[:7],
strings.TrimRight(commit.Message, "\r\n")) + authorName
strings.TrimSuffix(commit.Message, "\r\n")) + authorName
// add linebreak to each commit but the last
if i < len(p.Commits)-1 {
text += "\n"
Expand Down