aboutsummaryrefslogtreecommitdiffstats
path: root/modules/template
diff options
context:
space:
mode:
Diffstat (limited to 'modules/template')
-rw-r--r--modules/template/template.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/template/template.go b/modules/template/template.go
index 6c070b7009..6099fcc987 100644
--- a/modules/template/template.go
+++ b/modules/template/template.go
@@ -130,8 +130,10 @@ func Sha1(str string) string {
}
func ToUtf8WithErr(content []byte) (error, string) {
- charsetLabel := base.DetectEncoding(content)
- if charsetLabel == "utf-8" {
+ charsetLabel, err := base.DetectEncoding(content)
+ if err != nil {
+ return err, ""
+ } else if charsetLabel == "UTF-8" {
return nil, string(content)
}