mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Use TruncateString(sha1,10) in ShortSha and deprecate it.
This commit is contained in:
		@@ -42,11 +42,9 @@ func EncodeSha1(str string) string {
 | 
			
		||||
	return hex.EncodeToString(h.Sum(nil))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ShortSha is basically just truncating. It is DEPRECATED and will be removed in the future.
 | 
			
		||||
func ShortSha(sha1 string) string {
 | 
			
		||||
	if len(sha1) > 10 {
 | 
			
		||||
		return sha1[:10]
 | 
			
		||||
	}
 | 
			
		||||
	return sha1
 | 
			
		||||
	return TruncateString(sha1, 10)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func DetectEncoding(content []byte) (string, error) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user