diff options
author | Gary Wang <wzc782970009@gmail.com> | 2021-07-20 01:39:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-19 19:39:50 +0200 |
commit | d268c9d6e14f749c4631892b7faabd0a7d77d29a (patch) | |
tree | ef5164be9713f9af70ac3c3b938917ea5e60c517 /services/wiki | |
parent | 7f6019e492d50e4d07498b17dac0bf437fdd66ec (diff) | |
download | gitea-d268c9d6e14f749c4631892b7faabd0a7d77d29a.tar.gz gitea-d268c9d6e14f749c4631892b7faabd0a7d77d29a.zip |
fix: support delete non-urlencoded wiki page (#16482) (#16486)
* fix: support delete non-urlencoded wiki page
* fix: check error
Diffstat (limited to 'services/wiki')
-rw-r--r-- | services/wiki/wiki.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go index 16301034da..94f36ea2f2 100644 --- a/services/wiki/wiki.go +++ b/services/wiki/wiki.go @@ -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) |