From 1fe1733c823e12674e6175f3fda177ff23ccc928 Mon Sep 17 00:00:00 2001 From: Vladimir Iliakov Date: Wed, 25 Feb 2026 11:14:27 +0100 Subject: [PATCH] STAC-24338: Fix stackgraph restore --latest when S3 prefix is set --- cmd/stackgraph/restore.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/stackgraph/restore.go b/cmd/stackgraph/restore.go index 702704e..1f61c42 100644 --- a/cmd/stackgraph/restore.go +++ b/cmd/stackgraph/restore.go @@ -5,6 +5,7 @@ import ( "fmt" "sort" "strconv" + "strings" "time" "github.com/aws/aws-sdk-go-v2/aws" @@ -187,8 +188,8 @@ func getLatestBackup(k8sClient *k8s.Client, namespace string, config *config.Con sort.Slice(filteredObjects, func(i, j int) bool { return filteredObjects[i].LastModified.After(filteredObjects[j].LastModified) }) - - return filteredObjects[0].Key, nil + latestBackup := strings.TrimPrefix(filteredObjects[0].Key, prefix) + return latestBackup, nil } // buildPVCSpec builds a PVCSpec from configuration