Skip to content

Commit e697a59

Browse files
committed
pkg/payload/task: use st.Manifest.OriginalFilename if object doesn't have a name
1 parent a45fa12 commit e697a59

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/payload/task.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ func (st *Task) Copy() *Task {
5353
}
5454

5555
func (st *Task) String() string {
56+
name := st.Manifest.Object().GetName()
57+
if len(name) == 0 {
58+
name = st.Manifest.OriginalFilename
59+
}
5660
ns := st.Manifest.Object().GetNamespace()
5761
if len(ns) == 0 {
58-
return fmt.Sprintf("%s %q (%d of %d)", strings.ToLower(st.Manifest.GVK.Kind), st.Manifest.Object().GetName(), st.Index, st.Total)
62+
return fmt.Sprintf("%s %q (%d of %d)", strings.ToLower(st.Manifest.GVK.Kind), name, st.Index, st.Total)
5963
}
60-
return fmt.Sprintf("%s \"%s/%s\" (%d of %d)", strings.ToLower(st.Manifest.GVK.Kind), ns, st.Manifest.Object().GetName(), st.Index, st.Total)
64+
return fmt.Sprintf("%s \"%s/%s\" (%d of %d)", strings.ToLower(st.Manifest.GVK.Kind), ns, name, st.Index, st.Total)
6165
}
6266

6367
// Run attempts to create the provided object until it succeeds or context is cancelled. It returns the

0 commit comments

Comments
 (0)