mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	#2283 set text/plain for non-binary files in raw mode
This commit is contained in:
		@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user