fix: listObjectVersions Include object in marker (#11562)

ListObjectVersions would skip past the object in the marker when version id is specified. 
Make `listPath` return the object with the marker and truncate it if not needed.

Avoid having to parse unintended objects to find a version marker.
This commit is contained in:
Klaus Post
2021-03-01 08:12:02 -08:00
committed by GitHub
parent 289b22d911
commit 10bdb78699
4 changed files with 32 additions and 19 deletions

View File

@@ -56,7 +56,7 @@ type listPathOptions struct {
FilterPrefix string
// Marker to resume listing.
// The response will be the first entry AFTER this object name.
// The response will be the first entry >= this object name.
Marker string
// Limit the number of results.
@@ -157,7 +157,7 @@ func (o *listPathOptions) gatherResults(in <-chan metaCacheEntry) func() (metaCa
continue
}
o.debugln("gather got:", entry.name)
if o.Marker != "" && entry.name <= o.Marker {
if o.Marker != "" && entry.name < o.Marker {
o.debugln("pre marker")
continue
}
@@ -311,16 +311,6 @@ func (r *metacacheReader) filter(o listPathOptions) (entries metaCacheEntriesSor
if err != nil {
return entries, err
}
next, err := r.peek()
if err != nil {
return entries, err
}
if next.name == o.Marker {
err := r.skip(1)
if err != nil {
return entries, err
}
}
}
o.debugln("forwarded to ", o.Prefix, "marker:", o.Marker, "sep:", o.Separator)