File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
templates/package/content Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ 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+
4452// BasicAuthDecode decode basic auth string
4553func BasicAuthDecode (encoded string ) (string , string , error ) {
4654 s , err := base64 .StdEncoding .DecodeString (encoded )
Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ func NewFuncMap() template.FuncMap {
162162 // -----------------------------------------------------------------
163163 // misc
164164 "ShortSha" : base .ShortSha ,
165+ "ShortSha256" : base .ShortSha256 ,
165166 "ActionContent2Commits" : ActionContent2Commits ,
166167 "IsMultilineCommitMessage" : isMultilineCommitMessage ,
167168 "CommentMustAsDiff" : gitdiff .CommentMustAsDiff ,
Original file line number Diff line number Diff line change 3636 </thead>
3737 <tbody>
3838 {{range .PackageDescriptor.Metadata.Manifests}}
39- <tr>
40- <td><a href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{.Digest}}</a></td>
41- <td>{{.Platform}}</td>
42- <td>{{FileSize .Size}}</td>
43- </tr>
39+ {{if ne .Platform "unknown/unknown"}}
40+ <tr>
41+ <td><a href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{ShortSha256 .Digest}}</a></td>
42+ <td>{{.Platform}}</td>
43+ <td>{{FileSize .Size}}</td>
44+ </tr>
45+ {{end}}
4446 {{end}}
4547 </tbody>
4648 </table>
You can’t perform that action at this time.
0 commit comments