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.
|
- 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
|
- Cancelling via SIGINT (Ctrl-C) is now more responsive
|
||||||
- Fixed issue where a thread would hang due to TCP errors
|
- 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`.
|
- The `-w` flag now accepts comma delimited values in the form of `file1:W1,file2:W2`.
|
||||||
|
|
||||||
- v1.1.0
|
- v1.1.0
|
||||||
|
|||||||
@ -30,11 +30,21 @@ func NewFilterByName(name string, value string) (ffuf.FilterProvider, error) {
|
|||||||
|
|
||||||
//AddFilter adds a new filter to Config
|
//AddFilter adds a new filter to Config
|
||||||
func AddFilter(conf *ffuf.Config, name string, option string) error {
|
func AddFilter(conf *ffuf.Config, name string, option string) error {
|
||||||
newf, err := NewFilterByName(name, option)
|
newf, err := NewFilterByName(name, option)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
conf.Filters[name] = newf
|
// valid filter create or append
|
||||||
}
|
if conf.Filters[name] == nil {
|
||||||
return err
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
//AddMatcher adds a new matcher to Config
|
//AddMatcher adds a new matcher to Config
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user