aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author赵智超 <1012112796@qq.com>2020-07-03 12:49:55 +0800
committerGitHub <noreply@github.com>2020-07-03 00:49:55 -0400
commit8f6401705843fa1edd67ea02d5377c4385b2bf23 (patch)
treede5e7eeae5ed9ae00606b05705d2762b9ae43f11
parentd737eaa63a22344595347dfcbc23d8a7a13a88ee (diff)
downloadgitea-8f6401705843fa1edd67ea02d5377c4385b2bf23.tar.gz
gitea-8f6401705843fa1edd67ea02d5377c4385b2bf23.zip
Fix ui bug in wiki commit page (#12089) (#12125)
* Fix ui bug in wiki commit page TODO: Maybe we should allow wiki to have its own ``.editorconfig`` file. Signed-off-by: a1012112796 <1012112796@qq.com> * fix a small nit Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
-rw-r--r--modules/templates/helper.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 374f13af0f..bcd22f79f4 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -164,9 +164,16 @@ func NewFuncMap() []template.FuncMap {
mimeType := mime.TypeByExtension(filepath.Ext(filename))
return strings.HasPrefix(mimeType, "image/")
},
- "TabSizeClass": func(ec *editorconfig.Editorconfig, filename string) string {
+ "TabSizeClass": func(ec interface{}, filename string) string {
+ var (
+ value *editorconfig.Editorconfig
+ ok bool
+ )
if ec != nil {
- def, err := ec.GetDefinitionForFilename(filename)
+ if value, ok = ec.(*editorconfig.Editorconfig); !ok || value == nil {
+ return "tab-size-8"
+ }
+ def, err := value.GetDefinitionForFilename(filename)
if err != nil {
log.Error("tab size class: getting definition for filename: %v", err)
return "tab-size-8"