0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-19 00:11:24 +01:00

Use TruncateString(sha1,10) in ShortSha and deprecate it.

This commit is contained in:
Matthias Loibl 2016-11-07 21:36:01 +01:00
parent 030ba2894f
commit 86c32f2706
No known key found for this signature in database
GPG key ID: B1C7DF661ABB2C1A

View file

@ -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) {