aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-04-21 16:05:53 +0000
committerGitHub <noreply@github.com>2022-04-22 00:05:53 +0800
commit3ec1b6c2238c9eb46709091567eb2564aec86d99 (patch)
tree5cfc9979a23817ec9e6dcb83c21226d71df2318c
parentc764355676eb6d67674d095f92576a85688fe6cb (diff)
downloadgitea-3ec1b6c2238c9eb46709091567eb2564aec86d99.tar.gz
gitea-3ec1b6c2238c9eb46709091567eb2564aec86d99.zip
Fix logging of Transfer API (#19456)
- Use the correct fullname's in tracing calls. - Return correct function name in error. Co-authored-by: 6543 <6543@obermui.de>
-rw-r--r--routers/api/v1/repo/transfer.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/routers/api/v1/repo/transfer.go b/routers/api/v1/repo/transfer.go
index 7578fbd187..241c578e60 100644
--- a/routers/api/v1/repo/transfer.go
+++ b/routers/api/v1/repo/transfer.go
@@ -104,14 +104,16 @@ func Transfer(ctx *context.APIContext) {
ctx.Repo.GitRepo = nil
}
+ oldFullname := ctx.Repo.Repository.FullName()
+
if err := repo_service.StartRepositoryTransfer(ctx.Doer, newOwner, ctx.Repo.Repository, teams); err != nil {
if models.IsErrRepoTransferInProgress(err) {
- ctx.Error(http.StatusConflict, "CreatePendingRepositoryTransfer", err)
+ ctx.Error(http.StatusConflict, "StartRepositoryTransfer", err)
return
}
if repo_model.IsErrRepoAlreadyExist(err) {
- ctx.Error(http.StatusUnprocessableEntity, "CreatePendingRepositoryTransfer", err)
+ ctx.Error(http.StatusUnprocessableEntity, "StartRepositoryTransfer", err)
return
}
@@ -120,12 +122,12 @@ func Transfer(ctx *context.APIContext) {
}
if ctx.Repo.Repository.Status == repo_model.RepositoryPendingTransfer {
- log.Trace("Repository transfer initiated: %s -> %s", ctx.Repo.Repository.FullName(), newOwner.Name)
+ log.Trace("Repository transfer initiated: %s -> %s", oldFullname, ctx.Repo.Repository.FullName())
ctx.JSON(http.StatusCreated, convert.ToRepo(ctx.Repo.Repository, perm.AccessModeAdmin))
return
}
- log.Trace("Repository transferred: %s -> %s", ctx.Repo.Repository.FullName(), newOwner.Name)
+ log.Trace("Repository transferred: %s -> %s", oldFullname, ctx.Repo.Repository.FullName())
ctx.JSON(http.StatusAccepted, convert.ToRepo(ctx.Repo.Repository, perm.AccessModeAdmin))
}