Skip to content

Commit e0e3a35

Browse files
committed
Update
1 parent 1c5a289 commit e0e3a35

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

modules/base/tool.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ func ShortSha(sha1 string) string {
4141
return TruncateString(sha1, 10)
4242
}
4343

44-
// ShortSha256 takes 7-17 indexes of sha256 string as short sha256
45-
func ShortSha256(sha256 string) string {
46-
if utf8.RuneCountInString(sha256) < 17 {
47-
return sha256
48-
}
49-
return string([]rune(sha256)[7:17])
50-
}
51-
5244
// BasicAuthDecode decode basic auth string
5345
func BasicAuthDecode(encoded string) (string, string, error) {
5446
s, err := base64.StdEncoding.DecodeString(encoded)

modules/templates/helper.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ func NewFuncMap() template.FuncMap {
162162
// -----------------------------------------------------------------
163163
// misc
164164
"ShortSha": base.ShortSha,
165-
"ShortSha256": base.ShortSha256,
166165
"ActionContent2Commits": ActionContent2Commits,
167166
"IsMultilineCommitMessage": isMultilineCommitMessage,
168167
"CommentMustAsDiff": gitdiff.CommentMustAsDiff,

modules/templates/util_string.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,7 @@ func (su *StringUtils) EllipsisString(s string, maxLength int) string {
6060
func (su *StringUtils) ToUpper(s string) string {
6161
return strings.ToUpper(s)
6262
}
63+
64+
func (su *StringUtils) TrimPrefix(s, prefix string) string {
65+
return strings.TrimPrefix(s, prefix)
66+
}

templates/package/content/container.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{{range .PackageDescriptor.Metadata.Manifests}}
3939
{{if ne .Platform "unknown/unknown"}}
4040
<tr>
41-
<td><a class="ui sha label" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{ShortSha256 .Digest}}</a></td>
41+
<td><a class="ui sha label" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{StringUtils.TrimPrefix .Digest "sha256:" | ShortSha}}</a></td>
4242
<td>{{.Platform}}</td>
4343
<td>{{FileSize .Size}}</td>
4444
</tr>

0 commit comments

Comments
 (0)