mirror of https://github.com/go-gitea/gitea.git
Refactor use TrimSuffix instead of TrimRight (#12993)
* Refactor use TrimSuffix instead of TrimRight * TrimRight right * has #12990
This commit is contained in:
parent
551473b294
commit
818d921bbb
|
@ -93,7 +93,7 @@ func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// Remove the trailing slash at the end of setting.AppURL, the 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
|
// URI always contains a leading slash, which would result in a double
|
||||||
// slash
|
// slash
|
||||||
target := strings.TrimRight(setting.AppURL, "/") + r.URL.RequestURI()
|
target := strings.TrimSuffix(setting.AppURL, "/") + r.URL.RequestURI()
|
||||||
http.Redirect(w, r, target, http.StatusFound)
|
http.Redirect(w, r, target, http.StatusFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -397,7 +397,7 @@ func (u *User) generateRandomAvatar(e Engine) error {
|
||||||
// the local explore page. Function returns immediately.
|
// the local explore page. Function returns immediately.
|
||||||
// When applicable, the link is for an avatar of the indicated size (in pixels).
|
// When applicable, the link is for an avatar of the indicated size (in pixels).
|
||||||
func (u *User) SizedRelAvatarLink(size int) string {
|
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
|
// RealSizedAvatarLink returns a link to the user's avatar. When
|
||||||
|
|
|
@ -934,7 +934,7 @@ func NewContext() {
|
||||||
|
|
||||||
sec = Cfg.Section("U2F")
|
sec = Cfg.Section("U2F")
|
||||||
U2F.TrustedFacets, _ = shellquote.Split(sec.Key("TRUSTED_FACETS").MustString(strings.TrimRight(AppURL, "/")))
|
U2F.TrustedFacets, _ = shellquote.Split(sec.Key("TRUSTED_FACETS").MustString(strings.TrimRight(AppURL, "/")))
|
||||||
U2F.AppID = sec.Key("APP_ID").MustString(strings.TrimRight(AppURL, "/"))
|
U2F.AppID = sec.Key("APP_ID").MustString(strings.TrimSuffix(AppURL, "/"))
|
||||||
|
|
||||||
UI.ReactionsMap = make(map[string]bool)
|
UI.ReactionsMap = make(map[string]bool)
|
||||||
for _, reaction := range UI.Reactions {
|
for _, reaction := range UI.Reactions {
|
||||||
|
|
Loading…
Reference in New Issue