From 9246990496d9ed643d6d084a5f52979c1caf188b Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Tue, 16 Apr 2024 08:41:27 -0700 Subject: [PATCH] fix: ListObjectVersions returning duplicates when resuming with null version id (#19518) When resuming a versioned listing where `version-id-marker=null`, the `null` object would always be returned, causing duplicate entries to be returned. Add check against empty version --- cmd/storage-datatypes.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/storage-datatypes.go b/cmd/storage-datatypes.go index cfe20f710..b2717b734 100644 --- a/cmd/storage-datatypes.go +++ b/cmd/storage-datatypes.go @@ -152,6 +152,15 @@ func (f *FileInfoVersions) findVersionIndex(v string) int { if f == nil || v == "" { return -1 } + if v == nullVersionID { + for i, ver := range f.Versions { + if ver.VersionID == "" { + return i + } + } + return -1 + } + for i, ver := range f.Versions { if ver.VersionID == v { return i