Merge pull request #3615 from mparry/fix-search-crash

fix(helm): Don't crash in search if upper case chars are encountered
pull/3506/merge
Taylor Thomas 7 years ago committed by GitHub
commit 9bd03fd571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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