File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ func printFileReport(file entity.File, webSvc webapi.Service) {
5757 // File identification.
5858 fmt .Println (headerStyle .Render ("Identification" ))
5959 printKV ("SHA256" , file .SHA256 )
60+ if name := submissionFilename (file .Submissions ); name != "" {
61+ printKV ("Filename" , name )
62+ }
6063 if ! file .IsArchive {
6164 printKV ("MD5" , file .MD5 )
6265 printKV ("SHA1" , file .SHA1 )
@@ -324,3 +327,14 @@ func formatTimestamp(ts int64) string {
324327 t := time .Unix (ts , 0 )
325328 return t .Format ("2006-01-02 15:04:05 UTC" )
326329}
330+
331+ // submissionFilename returns the first submission filename that does not look
332+ // like a bare hash (MD5/SHA1/SHA256), or empty string if none is found.
333+ func submissionFilename (submissions []entity.Submission ) string {
334+ for _ , s := range submissions {
335+ if s .Filename != "" && ! looksLikeHash (s .Filename ) {
336+ return s .Filename
337+ }
338+ }
339+ return ""
340+ }
You can’t perform that action at this time.
0 commit comments