forked from gitea/gitea
1
0
Fork 0

Use OriginalURL insead of CloneAddr in migration logging (#9418) (#9420)

CloneAddr will contain username and password credentials and they will
get stored in system notices about failed migrations (and logs if trace
is set). Replace with OriginalURL that doesn't have those.
This commit is contained in:
mrsdizzie 2019-12-18 21:02:47 -05:00 committed by techknowlogick
parent 3a14a69e8a
commit e03934f035
1 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ func MigrateRepository(doer *models.User, ownerName string, opts base.MigrateOpt
opts.PullRequests = false opts.PullRequests = false
opts.GitServiceType = structs.PlainGitService opts.GitServiceType = structs.PlainGitService
downloader = NewPlainGitDownloader(ownerName, opts.RepoName, opts.CloneAddr) downloader = NewPlainGitDownloader(ownerName, opts.RepoName, opts.CloneAddr)
log.Trace("Will migrate from git: %s", opts.CloneAddr) log.Trace("Will migrate from git: %s", opts.OriginalURL)
} else if opts.GitServiceType == structs.NotMigrated { } else if opts.GitServiceType == structs.NotMigrated {
opts.GitServiceType = theFactory.GitServiceType() opts.GitServiceType = theFactory.GitServiceType()
} }
@ -68,7 +68,7 @@ func MigrateRepository(doer *models.User, ownerName string, opts base.MigrateOpt
log.Error("rollback failed: %v", err1) log.Error("rollback failed: %v", err1)
} }
if err2 := models.CreateRepositoryNotice(fmt.Sprintf("Migrate repository from %s failed: %v", opts.CloneAddr, err)); err2 != nil { if err2 := models.CreateRepositoryNotice(fmt.Sprintf("Migrate repository from %s failed: %v", opts.OriginalURL, err)); err2 != nil {
log.Error("create respotiry notice failed: ", err2) log.Error("create respotiry notice failed: ", err2)
} }
return nil, err return nil, err