diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-29 02:14:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 14:14:26 -0400 |
commit | a6450494c3a9c05667ae8a2ebdfdea55b8206e9b (patch) | |
tree | e4c6eba554eb4866337f82f2f96521b4b9370f84 /routers/api | |
parent | 572af214a7256fde76d0fa69fc5791b1758455ef (diff) | |
download | gitea-a6450494c3a9c05667ae8a2ebdfdea55b8206e9b.tar.gz gitea-a6450494c3a9c05667ae8a2ebdfdea55b8206e9b.zip |
Fix unclear `IsRepositoryExist` logic (#24374)
There was only one `IsRepositoryExist` function, it did: `has && isDir`
However it's not right, and it would cause 500 error when creating a new
repository if the dir exists.
Then, it was changed to `has || isDir`, it is still incorrect, it
affects the "adopt repo" logic.
To make the logic clear:
* IsRepositoryModelOrDirExist
* IsRepositoryModelExist
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/admin/adopt.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/v1/admin/adopt.go b/routers/api/v1/admin/adopt.go index 47fd0ef3c3..ccd8be9171 100644 --- a/routers/api/v1/admin/adopt.go +++ b/routers/api/v1/admin/adopt.go @@ -95,7 +95,7 @@ func AdoptRepository(ctx *context.APIContext) { } // check not a repo - has, err := repo_model.IsRepositoryExist(ctx, ctxUser, repoName) + has, err := repo_model.IsRepositoryModelExist(ctx, ctxUser, repoName) if err != nil { ctx.InternalServerError(err) return @@ -157,7 +157,7 @@ func DeleteUnadoptedRepository(ctx *context.APIContext) { } // check not a repo - has, err := repo_model.IsRepositoryExist(ctx, ctxUser, repoName) + has, err := repo_model.IsRepositoryModelExist(ctx, ctxUser, repoName) if err != nil { ctx.InternalServerError(err) return |