mirror of
https://github.com/distribution/distribution.git
synced 2026-07-16 16:59:52 +00:00
The S3 driver's Walk used a bare strings.HasPrefix to decide whether a walkInfo was under the last ErrSkipDir directory. Without a trailing "/" on the parent, a sibling whose name starts with the skipped directory's name (e.g. "0.1.20" after "0.1.2") falsely matched and was skipped, so its tag dir was never emitted to handleTag and the tag was omitted from /v2/<name>/tags/list. Replace the prefix check with isSubpath, which appends "/" to the parent so only true descendants match. Add a unit test pinning the sibling-with-lexical-prefix case. The bug is S3-only because the filesystem and inmemory drivers list directories recursively via WalkFallback and don't use this skip mechanism. It surfaced in 3.1.0 when the tags handler switched from tagService.All() (driver List with delimiter) to tagService.List() (driver Walk) for pagination support. Fixes #4891 Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>