Skip to content

Commit a833df2

Browse files
authored
STAC-24338: Fix listing stackgraph/settings backups when S3 prefix is set (#15)
1 parent 5e3c9f6 commit a833df2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cmd/settings/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func getBackupListFromS3(appCtx *app.Context) ([]BackupFileInfo, error) {
150150
var backups []BackupFileInfo
151151
for _, obj := range filteredObjects {
152152
row := BackupFileInfo{
153-
Filename: obj.Key,
153+
Filename: strings.TrimPrefix(obj.Key, prefix),
154154
LastModified: obj.LastModified,
155155
Size: obj.Size,
156156
}

cmd/stackgraph/list.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"sort"
7+
"strings"
78

89
"github.com/aws/aws-sdk-go-v2/aws"
910
"github.com/aws/aws-sdk-go-v2/service/s3"
@@ -75,7 +76,7 @@ func runList(appCtx *app.Context) error {
7576

7677
for _, obj := range filteredObjects {
7778
row := []string{
78-
obj.Key,
79+
strings.TrimPrefix(obj.Key, prefix),
7980
obj.LastModified.Format("2006-01-02 15:04:05 MST"),
8081
output.FormatBytes(obj.Size),
8182
}

0 commit comments

Comments
 (0)