#2283 set text/plain for non-binary files in raw mode
This commit is contained in:
parent
85af36332b
commit
93f03707a7
5 changed files with 10 additions and 4 deletions
|
@ -53,7 +53,11 @@ func ShortSha(sha1 string) string {
|
|||
}
|
||||
|
||||
func DetectEncoding(content []byte) string {
|
||||
_, name, certain := charset.DetermineEncoding(content, setting.Repository.AnsiCharset)
|
||||
_, name, certain := charset.DetermineEncoding(content, "")
|
||||
if name != "utf-8" && len(setting.Repository.AnsiCharset) > 0 {
|
||||
log.Debug("Using default AnsiCharset: %s", setting.Repository.AnsiCharset)
|
||||
return setting.Repository.AnsiCharset
|
||||
}
|
||||
log.Debug("Detected encoding: %s (%v)", name, certain)
|
||||
return name
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue