fix(helm): Don't crash in search if upper case chars are encountered.

Closes #3088
pull/3615/head
Morgan Parry 7 years ago
parent 6cb83d4a81
commit d848990122

@ -146,11 +146,11 @@ func (i *Index) SearchLiteral(term string, threshold int) []*Result {
term = strings.ToLower(term)
buf := []*Result{}
for k, v := range i.lines {
k = strings.ToLower(k)
v = strings.ToLower(v)
res := strings.Index(v, term)
if score := i.calcScore(res, v); res != -1 && score < threshold {
parts := strings.Split(k, verSep) // Remove version, if it is there.
lk := strings.ToLower(k)
lv := strings.ToLower(v)
res := strings.Index(lv, term)
if score := i.calcScore(res, lv); res != -1 && score < threshold {
parts := strings.Split(lk, verSep) // Remove version, if it is there.
buf = append(buf, &Result{Name: parts[0], Score: score, Chart: i.charts[k]})
}
}

@ -91,10 +91,10 @@ var indexfileEntries = map[string]repo.ChartVersions{
},
},
{
URLs: []string{"http://example.com/charts/santa-maria-1.2.2.tgz"},
URLs: []string{"http://example.com/charts/santa-maria-1.2.2-rc-1.tgz"},
Metadata: &chart.Metadata{
Name: "santa-maria",
Version: "1.2.2",
Version: "1.2.2-RC-1",
Description: "Three boat",
},
},

Loading…
Cancel
Save