s3api: fix ListObjectsV2 NextContinuationToken duplication for nested prefix (#8294)

* s3api: fix duplicate ListObjectsV2 continuation token for nested prefix

* s3api: include prefix in common-prefix continuation token
This commit is contained in:
Chris Lu
2026-02-10 14:17:41 -08:00
committed by GitHub
parent 2d97685390
commit 822dbed552
2 changed files with 44 additions and 19 deletions

View File

@@ -148,6 +148,26 @@ func Test_normalizePrefixMarker(t *testing.T) {
}
}
func TestBuildTruncatedNextMarker(t *testing.T) {
t.Run("does not duplicate prefix segment in next continuation token", func(t *testing.T) {
prefix := "export_2026-02-10_17-00-23"
nextMarker := "export_2026-02-10_17-00-23/4156000e.jpg"
actual := buildTruncatedNextMarker("xemu", prefix, nextMarker, false, "")
assert.Equal(t, "xemu/export_2026-02-10_17-00-23/4156000e.jpg", actual)
})
t.Run("keeps common prefix marker trailing slash", func(t *testing.T) {
actual := buildTruncatedNextMarker("xemu", "export_2026-02-10_17-00-23", "", true, "nested")
assert.Equal(t, "xemu/export_2026-02-10_17-00-23/nested/", actual)
})
t.Run("includes prefix for common prefix marker when request dir is empty", func(t *testing.T) {
actual := buildTruncatedNextMarker("", "foo", "", true, "bar")
assert.Equal(t, "foo/bar/", actual)
})
}
func TestAllowUnorderedParameterValidation(t *testing.T) {
// Test getListObjectsV1Args with allow-unordered parameter
t.Run("getListObjectsV1Args with allow-unordered", func(t *testing.T) {