]> source.dussan.org Git - gitea.git/commitdiff
fix: support delete non-urlencoded wiki page (#16482) (#16486)
authorGary Wang <wzc782970009@gmail.com>
Mon, 19 Jul 2021 17:39:50 +0000 (01:39 +0800)
committerGitHub <noreply@github.com>
Mon, 19 Jul 2021 17:39:50 +0000 (19:39 +0200)
* fix: support delete non-urlencoded wiki page

* fix: check error

services/wiki/wiki.go

index 16301034da15e4a40aacd45444277f0a4067d646..94f36ea2f250496ac336be525754dd7f23e1af55 100644 (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)