Browse Source

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

tags/v1.21.12.1
Matthias Loibl 8 years ago
parent
commit
86c32f2706
No known key found for this signature in database GPG Key ID: B1C7DF661ABB2C1A
1 changed files with 2 additions and 4 deletions
  1. +2
    -4
      modules/base/tool.go

+ 2
- 4
modules/base/tool.go 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) {


Loading…
Cancel
Save