From ce1f565003064c6f5d7d9c6d6c87418ecc208b03 Mon Sep 17 00:00:00 2001 From: Mike Mangino Date: Tue, 19 May 2026 22:55:19 -0400 Subject: [PATCH] Fix ListObjects v1 marker pagination (#939) When listing with a prefix and a marker, the v1 ListObjects API was ignoring the marker entirely, causing the same page to be returned on every paginated call. Pass the marker as startAfter to listObjectsWithPrefixes for v1 requests so pagination advances correctly. Also emit and in the v1 XML response. --- .../hectorvent/floci/services/s3/S3Controller.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java b/src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java index ac29e20c17..5ce6e593ab 100644 --- a/src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java +++ b/src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java @@ -280,6 +280,7 @@ public class S3Controller { @QueryParam("start-after") String startAfter, @QueryParam("encoding-type") String encodingType, @QueryParam("key-marker") String keyMarker, + @QueryParam("marker") String marker, @Context UriInfo uriInfo) { validateRawUri(); try { @@ -355,8 +356,11 @@ public class S3Controller { } int max = (maxKeys != null && maxKeys > 0) ? maxKeys : 1000; + boolean v1 = !"2".equals(listType); + String effectiveStartAfter = v1 && marker != null ? marker : startAfter; + String effectiveContinuationToken = v1 ? null : continuationToken; S3Service.ListObjectsResult result = s3Service.listObjectsWithPrefixes( - bucket, prefix, delimiter, max, continuationToken, startAfter); + bucket, prefix, delimiter, max, effectiveContinuationToken, effectiveStartAfter); List objects = result.objects(); List commonPrefixes = result.commonPrefixes(); boolean v2 = "2".equals(listType); @@ -399,6 +403,11 @@ public class S3Controller { if (startAfter != null) { xml.elem("StartAfter", startAfter); } + } else { + xml.elem("Marker", marker != null ? marker : ""); + if (result.isTruncated() && result.nextContinuationToken() != null) { + xml.elem("NextMarker", result.nextContinuationToken()); + } } xml.end("ListBucketResult"); return Response.ok(xml.build()).build();