From 1f3b3dda0de4ddc2a83b164742d18653e2988884 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 08:50:30 +0000 Subject: [PATCH] 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> --- services/migrations/migrate.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/migrations/migrate.go b/services/migrations/migrate.go index 99f8dba92f..dfd56144f6 100644 --- a/services/migrations/migrate.go +++ b/services/migrations/migrate.go @@ -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) }