From 3bd143379d3ecc3c8c5c85c4ff66dd3a2fe9fd07 Mon Sep 17 00:00:00 2001 From: Alan Clucas Date: Wed, 26 Jun 2024 10:07:42 +0100 Subject: [PATCH] fix: check for errors when finding artifacts Attempt to fix https://github.com/argoproj/argo-workflows/issues/13248 `fi` is null in the stack trace, and `err` isn't being checked here. So check `err` and don't attempt to continue. Signed-off-by: Alan Clucas --- s3/s3.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/s3/s3.go b/s3/s3.go index f1c3b94a..5e6a7106 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -252,7 +252,11 @@ func generatePutTasks(keyPrefix, rootPath string) chan uploadTask { rootPath = filepath.Clean(rootPath) + string(os.PathSeparator) uploadTasks := make(chan uploadTask) go func() { - _ = filepath.Walk(rootPath, func(localPath string, fi os.FileInfo, _ error) error { + _ = filepath.Walk(rootPath, func(localPath string, fi os.FileInfo, err error) error { + if err != nil { + log.WithFields(log.Fields{"localPath": localPath}).Error("Failed to walk artifacts path", err) + return err + } relPath := strings.TrimPrefix(localPath, rootPath) if fi.IsDir() { return nil