1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-25 01:54:26 +00:00

fix: support delete non-urlencoded wiki page (#16482) (#16486)

* fix: support delete non-urlencoded wiki page

* fix: check error
This commit is contained in:
Gary Wang 2021-07-20 01:39:50 +08:00 committed by GitHub
parent 7f6019e492
commit d268c9d6e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,14 +308,9 @@ func DeleteWikiPage(doer *models.User, repo *models.Repository, wikiName string)
return fmt.Errorf("Unable to read HEAD tree to index in: %s %v", basePath, err)
}
wikiPath := NameToFilename(wikiName)
filesInIndex, err := gitRepo.LsFiles(wikiPath)
found := false
for _, file := range filesInIndex {
if file == wikiPath {
found = true
break
}
found, wikiPath, err := prepareWikiFileName(gitRepo, wikiName)
if err != nil {
return err
}
if found {
err := gitRepo.RemoveFilesFromIndex(wikiPath)