1 Commits

Author SHA1 Message Date
Chris Lu
bc1113208d fix: S3 listing NextMarker missing intermediate directory component (#8089)
* fix: S3 listing NextMarker missing intermediate directory component

When listing with nested prefixes like "character/member/", the NextMarker
was incorrectly constructed as "character/res024/" instead of
"character/member/res024/", causing continuation requests to fail.

Root cause: The code at line 331 was constructing NextMarker as:
  nextMarker = requestDir + "/" + nextMarker

This worked when nextMarker already contained the full relative path,
but failed when it was just the entry name from the innermost recursion.

Fix: Include the prefix component when constructing NextMarker:
  if prefix != "" {
      nextMarker = requestDir + "/" + prefix + "/" + nextMarker
  }

This ensures the full path is always constructed correctly for both:
- CommonPrefix entries (directories)
- Regular entries (files)

Also includes fix for cursor.prefixEndsOnDelimiter state leak that was
causing sibling directories to be incorrectly listed.

* test: add regression tests for NextMarker construction

Add comprehensive unit tests to verify NextMarker is correctly constructed
with nested prefixes. Tests cover:
- Regular entries with nested prefix (character/member/res024)
- CommonPrefix entries (directories)
- Edge cases (no requestDir, no prefix, deeply nested)

These tests ensure the fix prevents regression of the bug where
NextMarker was missing intermediate directory components.
2026-01-22 16:56:35 -08:00