@@ -436,7 +436,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
436436 Status : models .RepositoryBeingMigrated ,
437437 })
438438 if err != nil {
439- handleMigrateError (ctx , remoteAddr , err )
439+ handleMigrateError (ctx , ctxUser , remoteAddr , err )
440440 return
441441 }
442442
@@ -466,15 +466,15 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
466466 }()
467467
468468 if _ , err = migrations .MigrateRepository (ctx .User , ctxUser .Name , opts ); err != nil {
469- handleMigrateError (ctx , remoteAddr , err )
469+ handleMigrateError (ctx , ctxUser , remoteAddr , err )
470470 return
471471 }
472472
473473 log .Trace ("Repository migrated: %s/%s" , ctxUser .Name , form .RepoName )
474474 ctx .JSON (201 , repo .APIFormat (models .AccessModeAdmin ))
475475}
476476
477- func handleMigrateError (ctx * context.APIContext , remoteAddr string , err error ) {
477+ func handleMigrateError (ctx * context.APIContext , repoOwner * models. User , remoteAddr string , err error ) {
478478 switch {
479479 case models .IsErrRepoAlreadyExist (err ):
480480 ctx .Error (409 , "" , "The repository with the same name already exists." )
@@ -483,7 +483,7 @@ func handleMigrateError(ctx *context.APIContext, remoteAddr string, err error) {
483483 case migrations .IsTwoFactorAuthError (err ):
484484 ctx .Error (422 , "" , "Remote visit required two factors authentication." )
485485 case models .IsErrReachLimitOfRepo (err ):
486- ctx .Error (422 , "" , fmt .Sprintf ("You have already reached your limit of %d repositories." , ctx . User .MaxCreationLimit ()))
486+ ctx .Error (422 , "" , fmt .Sprintf ("You have already reached your limit of %d repositories." , repoOwner .MaxCreationLimit ()))
487487 case models .IsErrNameReserved (err ):
488488 ctx .Error (422 , "" , fmt .Sprintf ("The username '%s' is reserved." , err .(models.ErrNameReserved ).Name ))
489489 case models .IsErrNamePatternNotAllowed (err ):
0 commit comments