feat: search is case insensite

This commit is contained in:
Adrien Waksberg 2019-08-05 12:40:56 +02:00
parent f62438f22d
commit 905c175578
2 changed files with 4 additions and 2 deletions

View file

@ -16,6 +16,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
- Export in a file
- Use RandomString function for wallet's salt
- Search is case insensite
## v1.1.0 - 2019-07-23

View file

@ -107,13 +107,14 @@ func (w *Wallet) Save() error {
// SearchEntry return an array with the array expected with the pattern
func (w *Wallet) SearchEntry(pattern string, group string) []Entry {
var entries []Entry
r := regexp.MustCompile(pattern)
r := regexp.MustCompile(strings.ToLower(pattern))
for _, entry := range w.Entries {
if group != "" && strings.ToLower(entry.Group) != strings.ToLower(group) {
continue
}
if r.Match([]byte(entry.Name)) || r.Match([]byte(entry.Comment)) || r.Match([]byte(entry.URI)) {
if r.Match([]byte(strings.ToLower(entry.Name))) ||
r.Match([]byte(strings.ToLower(entry.Comment))) || r.Match([]byte(strings.ToLower(entry.URI))) {
entries = append(entries, entry)
}
}