0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-01-30 23:12:24 +01:00

Add TODO comment explaining why OriginalURL can be empty

Added TODO comment before the migration failure notice to document that opts.OriginalURL can be empty when migration is triggered via the API route, which doesn't set this field. The comment also suggests potential solutions.

Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>

Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-30 08:50:30 +00:00
parent ad0857e069
commit 1f3b3dda0d

View File

@ -131,6 +131,9 @@ func MigrateRepository(ctx context.Context, doer *user_model.User, ownerName str
if err1 := uploader.Rollback(); err1 != nil {
log.Error("rollback failed: %v", err1)
}
// TODO: opts.OriginalURL can be empty when migration is triggered via API (routers/api/v1/repo/migrate.go doesn't set it).
// This may result in a message like "Migrate repository (owner/repo) from failed" when OriginalURL is empty.
// Consider either: 1) ensuring OriginalURL is always set in the API, or 2) conditionally formatting this message.
if err2 := system_model.CreateRepositoryNotice(fmt.Sprintf("Migrate repository (%s/%s) from %s failed: %v", ownerName, opts.RepoName, opts.OriginalURL, err)); err2 != nil {
log.Error("create repository notice failed: ", err2)
}