Skip to content

fix: count CommonPrefixes in POSIX ListObjectsV2 responses - #2358

Merged
benmcclelland merged 1 commit into
versity:mainfrom
acerrah:patch-1
Sep 4, 2026
Merged

benmcclelland merged 1 commit into
versity:mainfrom
acerrah:patch-1

Conversation

@acerrah

@acerrah acerrah commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Problem

The POSIX backend calculated ListObjectsV2.KeyCount using only the
number of returned objects:

len(results.Objects)

When a delimiter listing returned only CommonPrefixes, the response
contained KeyCount=0 even though prefixes were present. This caused
Docker Registry garbage collection to fail with:
Path not found: /docker/registry/v2/repositories

Solution

Calculate KeyCount using both returned objects and common prefixes:

len(results.Objects) + len(results.CommonPrefixes)

This matches AWS S3 semantics and the existing Azure backend behavior.

Testing

  • go test ./backend/posix ./backend passed.
  • go test ./... passed.

AI Assistance

AI was used during the investigation and writing process to inspect the relevant code paths, identify the KeyCount calculation issue, and help prepare this pull request description. The final code change and test
results were reviewed manually.

@versity-github

Copy link
Copy Markdown
Collaborator

This won't automatically run in continuous integration without approval. A member of the Versity organization must allow it.

@benmcclelland
benmcclelland merged commit 33bc751 into versity:main Sep 4, 2026
142 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants