diff options
Diffstat (limited to 'modules/templates')
-rw-r--r-- | modules/templates/helper.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 2c53e05fca..9bb803c010 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -30,7 +30,7 @@ import ( "code.gitea.io/gitea/services/gitdiff" mirror_service "code.gitea.io/gitea/services/mirror" - "gopkg.in/editorconfig/editorconfig-core-go.v1" + "github.com/editorconfig/editorconfig-core-go/v2" ) // NewFuncMap returns functions for injecting to templates @@ -145,7 +145,11 @@ func NewFuncMap() []template.FuncMap { }, "TabSizeClass": func(ec *editorconfig.Editorconfig, filename string) string { if ec != nil { - def := ec.GetDefinitionForFilename(filename) + def, err := ec.GetDefinitionForFilename(filename) + if err != nil { + log.Error("tab size class: getting definition for filename: %v", err) + return "tab-size-8" + } if def.TabWidth > 0 { return fmt.Sprintf("tab-size-%d", def.TabWidth) } |