aboutsummaryrefslogtreecommitdiffstats
path: root/modules/template
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-31 22:13:47 -0500
committerUnknwon <u@gogs.io>2015-12-31 22:13:47 -0500
commit4993ab1a767bea5645a65b5639cc00bb107fdfd3 (patch)
tree47f5859ff0a7516d56e0155a9234c57e79cac6d8 /modules/template
parenta62290de52b5258b8f301c2f56ff84aa96e5f6d2 (diff)
downloadgitea-4993ab1a767bea5645a65b5639cc00bb107fdfd3.tar.gz
gitea-4993ab1a767bea5645a65b5639cc00bb107fdfd3.zip
#2185 fall back to use custom chardet lib
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)
}