From 283e87d8145ac5dd61f86f61e347ffa684ac5684 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Mon, 5 Feb 2018 16:56:30 +0200 Subject: 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 --- models/error.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'models/error.go') diff --git a/models/error.go b/models/error.go index cd96fa9256..a1c24f4ec0 100644 --- a/models/error.go +++ b/models/error.go @@ -216,6 +216,21 @@ func (err ErrWikiReservedName) Error() string { return fmt.Sprintf("wiki title is reserved: %s", err.Title) } +// ErrWikiInvalidFileName represents an invalid wiki file name. +type ErrWikiInvalidFileName struct { + FileName string +} + +// IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName. +func IsErrWikiInvalidFileName(err error) bool { + _, ok := err.(ErrWikiInvalidFileName) + return ok +} + +func (err ErrWikiInvalidFileName) Error() string { + return fmt.Sprintf("Invalid wiki filename: %s", err.FileName) +} + // __________ ___. .__ .__ ____ __. // \______ \__ _\_ |__ | | |__| ____ | |/ _|____ ___.__. // | ___/ | \ __ \| | | |/ ___\ | <_/ __ < | | -- cgit v1.2.3