diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-01-25 18:57:43 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2020-01-25 10:57:42 +0000 |
commit | a67c06ce90fb3bea97987501377e4dc5f24d2151 (patch) | |
tree | 40de3d2b2de625f44529859ec4fc642ab8d31f21 /models/repo.go | |
parent | 5b17bb8f3dbc180c72446000d82ba06fd7349dc7 (diff) | |
download | gitea-a67c06ce90fb3bea97987501377e4dc5f24d2151.tar.gz gitea-a67c06ce90fb3bea97987501377e4dc5f24d2151.zip |
Sanitize credentials in mirror form (#9975)
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 8 |
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{} |