Unverified Commit 9bd03fd5 authored by Taylor Thomas's avatar Taylor Thomas Committed by GitHub

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

fix(helm): Don't crash in search if upper case chars are encountered
parents 369e44ad d8489901
...@@ -146,11 +146,11 @@ func (i *Index) SearchLiteral(term string, threshold int) []*Result { ...@@ -146,11 +146,11 @@ func (i *Index) SearchLiteral(term string, threshold int) []*Result {
term = strings.ToLower(term) term = strings.ToLower(term)
buf := []*Result{} buf := []*Result{}
for k, v := range i.lines { for k, v := range i.lines {
k = strings.ToLower(k) lk := strings.ToLower(k)
v = strings.ToLower(v) lv := strings.ToLower(v)
res := strings.Index(v, term) res := strings.Index(lv, term)
if score := i.calcScore(res, v); res != -1 && score < threshold { if score := i.calcScore(res, lv); res != -1 && score < threshold {
parts := strings.Split(k, verSep) // Remove version, if it is there. parts := strings.Split(lk, verSep) // Remove version, if it is there.
buf = append(buf, &Result{Name: parts[0], Score: score, Chart: i.charts[k]}) buf = append(buf, &Result{Name: parts[0], Score: score, Chart: i.charts[k]})
} }
} }
......
...@@ -91,10 +91,10 @@ var indexfileEntries = map[string]repo.ChartVersions{ ...@@ -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{ Metadata: &chart.Metadata{
Name: "santa-maria", Name: "santa-maria",
Version: "1.2.2", Version: "1.2.2-RC-1",
Description: "Three boat", Description: "Three boat",
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment