1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-12 12:38:20 +00:00

fix bug when migrate repository 500 when repo is existed (#6188) (#6197)

This commit is contained in:
Lunny Xiao
2019-02-27 11:32:25 +08:00
committed by techknowlogick
parent d602ba564f
commit cbfc7f52b9
2 changed files with 10 additions and 0 deletions

View File

@@ -400,6 +400,11 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
RemoteAddr: remoteAddr,
})
if err != nil {
if models.IsErrRepoAlreadyExist(err) {
ctx.Error(409, "", "The repository with the same name already exists.")
return
}
err = util.URLSanitizedError(err, remoteAddr)
if repo != nil {
if errDelete := models.DeleteRepository(ctx.User, ctxUser.ID, repo.ID); errDelete != nil {