Skip to content

Commit e49b509

Browse files
committed
fix: we don't need to pop values
1 parent baa0fb6 commit e49b509

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

s3secrets-helper/s3/s3.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,11 @@ func (c *Client) ListSuffix(prefix string, suffixes []string) ([]string, error)
140140
})
141141

142142
// Iterate over all objects at the prefix and find those who match our suffix
143-
for i, object := range resp.Contents {
143+
for _, object := range resp.Contents {
144144
for _, suffix := range suffixes {
145145
if strings.HasSuffix(*object.Key, suffix) {
146-
if i < len(resp.Contents)-1 {
147-
keys = append(keys, *object.Key)
148-
resp.Contents = append(resp.Contents[:i], resp.Contents[i+1:]...) //since we have a match, pop it
149-
break //... then break out of the suffix loop
150-
} else {
151-
keys = append(keys, *object.Key) // No need to pop the object as we are at the end of the list
152-
} //... then break out of the suffix loop
146+
keys = append(keys, *object.Key)
147+
break //break out of the suffix loop
153148
}
154149
}
155150
}

0 commit comments

Comments
 (0)