[#1059] pilorama: Fix compare condition for subtree sort
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
parent
e12fcc041d
commit
bae4cc1c18
1 changed files with 4 additions and 2 deletions
|
@ -1073,8 +1073,10 @@ func (t *boltForest) TreeSortedByFilename(ctx context.Context, cid cidSDK.ID, tr
|
|||
return bytes.Compare(result[i].Meta.GetAttr(AttributeFilename), result[j].Meta.GetAttr(AttributeFilename)) == -1
|
||||
})
|
||||
for i := range result {
|
||||
if bytes.Compare([]byte(last), result[i].Meta.GetAttr(AttributeFilename)) == -1 {
|
||||
result = result[i:]
|
||||
if cmp := bytes.Compare([]byte(last), result[i].Meta.GetAttr(AttributeFilename)); cmp <= 0 {
|
||||
// if last == result[i], return next [i+1:] values
|
||||
// if last < result[i], return all values from [i:]
|
||||
result = result[i+cmp+1:]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue