heal: Fix new entries computation in listDirHeal (#3551)

A crash was happening due to an incorrect interpreation of the return value of sort.SearchString()
master
Anis Elleuch 8 years ago committed by Harshavardhana
parent 95d9e47353
commit eb6d53d2f5
  1. 4
      cmd/xl-v1-list-objects-heal.go

@ -58,7 +58,9 @@ func listDirHealFactory(isLeaf isLeafFunc, disks ...StorageAPI) listDirFunc {
// find elements in entries which are not in mergedentries // find elements in entries which are not in mergedentries
for _, entry := range entries { for _, entry := range entries {
idx := sort.SearchStrings(mergedEntries, entry) idx := sort.SearchStrings(mergedEntries, entry)
if mergedEntries[idx] == entry { // idx different from len(mergedEntries) means entry is not found
// in mergedEntries
if idx < len(mergedEntries) {
continue continue
} }
newEntries = append(newEntries, entry) newEntries = append(newEntries, entry)

Loading…
Cancel
Save