summaryrefslogtreecommitdiffstats
path: root/models/git_diff.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-13 19:56:33 -0500
committerUnknwon <u@gogs.io>2015-12-13 19:56:33 -0500
commit95f9c85bcc8f915d823f57cd5923302dfc156504 (patch)
treef6e74391810f4105f8b9712796df7f030b45095a /models/git_diff.go
parent79dcd7ee6e0c3bb576cf5d0ece583156c4466b95 (diff)
downloadgitea-95f9c85bcc8f915d823f57cd5923302dfc156504.tar.gz
gitea-95f9c85bcc8f915d823f57cd5923302dfc156504.zip
#2185 use Go sub-repo to detect encoding
Diffstat (limited to 'models/git_diff.go')
-rw-r--r--models/git_diff.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/models/git_diff.go b/models/git_diff.go
index a94ea0abc7..725806699e 100644
--- a/models/git_diff.go
+++ b/models/git_diff.go
@@ -244,8 +244,8 @@ func ParsePatch(maxlines int, reader io.Reader) (*Diff, error) {
buf.WriteString("\n")
}
}
- charsetLabel, err := base.DetectEncoding(buf.Bytes())
- if charsetLabel != "UTF-8" && err == nil {
+ charsetLabel := base.DetectEncoding(buf.Bytes())
+ if charsetLabel != "UTF-8" {
encoding, _ := charset.Lookup(charsetLabel)
if encoding != nil {
d := encoding.NewDecoder()