From e01b782f33aa062cc02a5201ef45bf1f91eb4546 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Tue, 20 Jul 2021 00:14:00 +0800 Subject: fix: support delete non-urlencoded wiki page (#16482) * fix: support delete non-urlencoded wiki page * fix: check error --- services/wiki/wiki.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'services/wiki/wiki.go') 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) -- cgit v1.2.3