From 2b47ad70923d2c2a958ca0eb9f45f4810099f254 Mon Sep 17 00:00:00 2001 From: Andrey Melnikov Date: Tue, 20 Jul 2021 13:01:14 -0700 Subject: [PATCH 1/2] fix: issue where s3 storage would not list files (but would list folders) --- pkg/workflow_execution.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/workflow_execution.go b/pkg/workflow_execution.go index 43d8040..fda5522 100644 --- a/pkg/workflow_execution.go +++ b/pkg/workflow_execution.go @@ -1745,13 +1745,16 @@ func (c *Client) ListFiles(namespace, key string) (files []*File, err error) { files = make([]*File, 0) - if key == "/" { - key = "" - } else if len(key) > 0 { + if len(key) > 0 && strings.HasPrefix(key, "/") { + key = key[1:] + } + + if len(key) > 0 { if string(key[len(key)-1]) != "/" { key += "/" } } + switch { case config.ArtifactRepository.S3 != nil: { From d0d68470dd233c5e5e8f1006bfbe97d35a263fc0 Mon Sep 17 00:00:00 2001 From: Andrey Melnikov Date: Tue, 20 Jul 2021 13:01:14 -0700 Subject: [PATCH 2/2] fix: issue where s3 storage would not list files (but would list folders) --- pkg/workflow_execution.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/workflow_execution.go b/pkg/workflow_execution.go index 43d8040..fda5522 100644 --- a/pkg/workflow_execution.go +++ b/pkg/workflow_execution.go @@ -1745,13 +1745,16 @@ func (c *Client) ListFiles(namespace, key string) (files []*File, err error) { files = make([]*File, 0) - if key == "/" { - key = "" - } else if len(key) > 0 { + if len(key) > 0 && strings.HasPrefix(key, "/") { + key = key[1:] + } + + if len(key) > 0 { if string(key[len(key)-1]) != "/" { key += "/" } } + switch { case config.ArtifactRepository.S3 != nil: {