Skip to content

Commit cd994f6

Browse files
a1012112796lunnyzeripath
authored
Fix ui bug in wiki commit page (#12089)
* 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>
1 parent 480ac25 commit cd994f6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/templates/helper.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,16 @@ func NewFuncMap() []template.FuncMap {
164164
mimeType := mime.TypeByExtension(filepath.Ext(filename))
165165
return strings.HasPrefix(mimeType, "image/")
166166
},
167-
"TabSizeClass": func(ec *editorconfig.Editorconfig, filename string) string {
167+
"TabSizeClass": func(ec interface{}, filename string) string {
168+
var (
169+
value *editorconfig.Editorconfig
170+
ok bool
171+
)
168172
if ec != nil {
169-
def, err := ec.GetDefinitionForFilename(filename)
173+
if value, ok = ec.(*editorconfig.Editorconfig); !ok || value == nil {
174+
return "tab-size-8"
175+
}
176+
def, err := value.GetDefinitionForFilename(filename)
170177
if err != nil {
171178
log.Error("tab size class: getting definition for filename: %v", err)
172179
return "tab-size-8"

0 commit comments

Comments
 (0)