1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-03 00:45:22 +02:00

Fix rendering of wiki page list if wiki repo contains other files (#3454)

* Fix rendering of wiki page list if wiki repo contains other files

* Improve wiki filename tests
This commit is contained in:
Lauris BH 2018-02-05 16:56:30 +02:00 committed by GitHub
parent b16c84de7b
commit 283e87d814
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 2 deletions

View file

@ -45,7 +45,7 @@ func WikiNameToFilename(name string) string {
// WikiFilenameToName converts a wiki filename to its corresponding page name.
func WikiFilenameToName(filename string) (string, error) {
if !strings.HasSuffix(filename, ".md") {
return "", fmt.Errorf("Invalid wiki filename: %s", filename)
return "", ErrWikiInvalidFileName{filename}
}
basename := filename[:len(filename)-3]
unescaped, err := url.QueryUnescape(basename)