aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorwxiaoguang2023-02-11 14:34:11 +0800
committerGitHub2023-02-11 14:34:11 +0800
commite9288c24773157411edec17c9bbcc8c1567e91ee (patch)
treeb34c730a13ab9a56d14b0fcccf1e136ca0233b68 /models
parent1cb8d14bf71e0b8637c9eaa10808b4fd05139f45 (diff)
Fix improper HTMLURL usages in Go code (#22839)
In Go code, HTMLURL should be only used for external systems, like API/webhook/mail/notification, etc. If a URL is used by `Redirect` or rendered in a template, it should be a relative URL (aka `Link()` in Gitea) Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models')
-rw-r--r--models/repo/repo.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/repo/repo.go b/models/repo/repo.go
index 5d3753620..e7ec93a22 100644
--- a/models/repo/repo.go
+++ b/models/repo/repo.go
@@ -274,7 +274,7 @@ func (repo *Repository) CommitLink(commitID string) (result string) {
if commitID == "" || commitID == "0000000000000000000000000000000000000000" {
result = ""
} else {
- result = repo.HTMLURL() + "/commit/" + url.PathEscape(commitID)
+ result = repo.Link() + "/commit/" + url.PathEscape(commitID)
}
return result
}