diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2023-09-16 18:03:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 16:03:02 +0000 |
commit | c766140dad3408048ad843d0e7b4ab5d9f5777c6 (patch) | |
tree | 49cd37606ae0cb252cd16264c111c3cf5b00088d /modules/repository | |
parent | 5e039b05801a2ceeb29b23c657110af02834b57e (diff) | |
download | gitea-c766140dad3408048ad843d0e7b4ab5d9f5777c6.tar.gz gitea-c766140dad3408048ad843d0e7b4ab5d9f5777c6.zip |
Add `RemoteAddress` to mirrors (#26952)
This PR adds a new field `RemoteAddress` to both mirror types which
contains the sanitized remote address for easier (database) access to
that information. Will be used in the audit PR if merged.
Diffstat (limited to 'modules/repository')
-rw-r--r-- | modules/repository/repo.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/repository/repo.go b/modules/repository/repo.go index 6bf88e7752..b50c8f75ca 100644 --- a/modules/repository/repo.go +++ b/modules/repository/repo.go @@ -180,12 +180,17 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User, defer committer.Close() if opts.Mirror { + remoteAddress, err := util.SanitizeURL(opts.CloneAddr) + if err != nil { + return repo, err + } mirrorModel := repo_model.Mirror{ RepoID: repo.ID, Interval: setting.Mirror.DefaultInterval, EnablePrune: true, NextUpdateUnix: timeutil.TimeStampNow().AddDuration(setting.Mirror.DefaultInterval), LFS: opts.LFS, + RemoteAddress: remoteAddress, } if opts.LFS { mirrorModel.LFSEndpoint = opts.LFSEndpoint |