summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-25 18:57:43 +0800
committerzeripath <art27@cantab.net>2020-01-25 10:57:42 +0000
commita67c06ce90fb3bea97987501377e4dc5f24d2151 (patch)
tree40de3d2b2de625f44529859ec4fc642ab8d31f21 /models/repo.go
parent5b17bb8f3dbc180c72446000d82ba06fd7349dc7 (diff)
downloadgitea-a67c06ce90fb3bea97987501377e4dc5f24d2151.tar.gz
gitea-a67c06ce90fb3bea97987501377e4dc5f24d2151.zip
Sanitize credentials in mirror form (#9975)
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go
index aa7639e4ba..5528a8e9d2 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -197,6 +197,14 @@ type Repository struct {
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
}
+// SanitizedOriginalURL returns a sanitized OriginalURL
+func (repo *Repository) SanitizedOriginalURL() string {
+ if repo.OriginalURL == "" {
+ return ""
+ }
+ return util.SanitizeURLCredentials(repo.OriginalURL, false)
+}
+
// ColorFormat returns a colored string to represent this repo
func (repo *Repository) ColorFormat(s fmt.State) {
var ownerName interface{}