From 86856507866b0f28a0fff7e432c2fda7800fb5c6 Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Fri, 13 Dec 2024 07:29:00 -0800 Subject: [PATCH] fix: ensure screenshots are recognized artifacts (#994) --- internal/http/resto.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/internal/http/resto.go b/internal/http/resto.go index fb9c3988e..b0cd7630b 100644 --- a/internal/http/resto.go +++ b/internal/http/resto.go @@ -7,7 +7,6 @@ import ( "fmt" "io" "net/http" - "reflect" "sort" "strings" "time" @@ -189,12 +188,25 @@ func (c *Resto) ArtifactNames(ctx context.Context, jobID string, realDevice bool var filesList []string for k, v := range filesMap { - if k == "video" || k == "screenshots" { + if v == nil || k == "video" { continue } - if v != nil && reflect.TypeOf(v).Name() == "string" { - filesList = append(filesList, v.(string)) + if val, ok := v.(string); ok { + filesList = append(filesList, val) + continue + } + + if k == "screenshots" { + screenshots, ok := v.([]interface{}) + if !ok { + continue + } + for _, s := range screenshots { + if screenshot, ok := s.(string); ok { + filesList = append(filesList, screenshot) + } + } } } return filesList, nil