Bug 231 (#312)
* Update filter.go * Upsert filter options Insert or update filter options. * Indent. * Updated CHANGELOG.md fix for: Option -ac overwriting other existing filters #231
This commit is contained in:
parent
19937c4929
commit
2abc72018d
@ -11,6 +11,7 @@
|
||||
- Pre-flight errors are now displayed also after the usage text to prevent the need to scroll through backlog.
|
||||
- Cancelling via SIGINT (Ctrl-C) is now more responsive
|
||||
- Fixed issue where a thread would hang due to TCP errors
|
||||
- Fixed the issue where the option -ac was overwriting existing filters. Now auto-calibration will add them where needed.
|
||||
- The `-w` flag now accepts comma delimited values in the form of `file1:W1,file2:W2`.
|
||||
|
||||
- v1.1.0
|
||||
|
||||
@ -32,7 +32,17 @@ func NewFilterByName(name string, value string) (ffuf.FilterProvider, error) {
|
||||
func AddFilter(conf *ffuf.Config, name string, option string) error {
|
||||
newf, err := NewFilterByName(name, option)
|
||||
if err == nil {
|
||||
// valid filter create or append
|
||||
if conf.Filters[name] == nil {
|
||||
conf.Filters[name] = newf
|
||||
} else {
|
||||
currentfilter := conf.Filters[name].Repr()
|
||||
newoption := strings.TrimSpace(strings.Split(currentfilter, ":")[1]) + "," + option
|
||||
newerf, err := NewFilterByName(name, newoption)
|
||||
if err == nil {
|
||||
conf.Filters[name] = newerf
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user