forked from Gitlink/gitea-1120-rc1
fix: edit wiki name not exsit error
This commit is contained in:
parent
0c897c660f
commit
86fb4bb8d8
|
@ -339,6 +339,11 @@ func EditWiki(ctx *context.APIContext, form api.WikiOption) {
|
|||
}
|
||||
wikiRepo, commit, _ := wikies.FindWikiRepoCommit(ctx)
|
||||
|
||||
if _, _, _, noEntry := wikies.WikiContentsByName(ctx, commit, oldWikiName); noEntry {
|
||||
ctx.Error(http.StatusNotFound, "WikiNotFound", "wiki不存在")
|
||||
return
|
||||
}
|
||||
|
||||
if _, _, _, noEntry := wikies.WikiContentsByName(ctx, commit, newWikiName); oldWikiName != newWikiName && !noEntry {
|
||||
ctx.Error(http.StatusConflict, "WikiNameAlreadyExist", "wiki名称已存在")
|
||||
return
|
||||
|
@ -352,7 +357,8 @@ func EditWiki(ctx *context.APIContext, form api.WikiOption) {
|
|||
ctx.Error(http.StatusInternalServerError, "EditWikiPage", err)
|
||||
return
|
||||
}
|
||||
data, entry, pageFilename, _ := wikies.WikiContentsByName(ctx, commit, form.Name)
|
||||
_, newCommit, _ := wikies.FindWikiRepoCommit(ctx)
|
||||
data, entry, pageFilename, _ := wikies.WikiContentsByName(ctx, newCommit, newWikiName)
|
||||
c, err := wikiRepo.GetCommitByPath(entry.Name())
|
||||
if err != nil {
|
||||
if models.IsErrWikiInvalidFileName(err) {
|
||||
|
|
Loading…
Reference in New Issue