diff options
author | Gary Wang <wzc782970009@gmail.com> | 2021-07-20 00:14:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-19 18:14:00 +0200 |
commit | e01b782f33aa062cc02a5201ef45bf1f91eb4546 (patch) | |
tree | 7b8650266bca578377f97e40f49e494cc126974a /services/wiki | |
parent | 2256499db53c158c3abe12c5a7191ea36eb4919e (diff) | |
download | gitea-e01b782f33aa062cc02a5201ef45bf1f91eb4546.tar.gz gitea-e01b782f33aa062cc02a5201ef45bf1f91eb4546.zip |
fix: support delete non-urlencoded wiki page (#16482)
* 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) |