diff options
author | Unknwon <u@gogs.io> | 2015-12-31 22:13:47 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-31 22:13:47 -0500 |
commit | 4993ab1a767bea5645a65b5639cc00bb107fdfd3 (patch) | |
tree | 47f5859ff0a7516d56e0155a9234c57e79cac6d8 /models | |
parent | a62290de52b5258b8f301c2f56ff84aa96e5f6d2 (diff) | |
download | gitea-4993ab1a767bea5645a65b5639cc00bb107fdfd3.tar.gz gitea-4993ab1a767bea5645a65b5639cc00bb107fdfd3.zip |
#2185 fall back to use custom chardet lib
Diffstat (limited to 'models')
-rw-r--r-- | models/git_diff.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/git_diff.go b/models/git_diff.go index 1b2fb5f2b1..22075ef76b 100644 --- a/models/git_diff.go +++ b/models/git_diff.go @@ -246,8 +246,8 @@ func ParsePatch(maxlines int, reader io.Reader) (*Diff, error) { buf.WriteString("\n") } } - charsetLabel := base.DetectEncoding(buf.Bytes()) - if charsetLabel != "UTF-8" { + charsetLabel, err := base.DetectEncoding(buf.Bytes()) + if charsetLabel != "UTF-8" && err == nil { encoding, _ := charset.Lookup(charsetLabel) if encoding != nil { d := encoding.NewDecoder() |