mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Fix filter list update warning on setting change
This commit is contained in:
parent
64b90b2bae
commit
6c4a77a205
1 changed files with 10 additions and 3 deletions
|
@ -2,7 +2,7 @@ package customlists
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
@ -35,6 +35,10 @@ var (
|
||||||
|
|
||||||
filterListLock sync.RWMutex
|
filterListLock sync.RWMutex
|
||||||
parserTask *modules.Task
|
parserTask *modules.Task
|
||||||
|
|
||||||
|
// ErrNotConfigured is returned when updating the custom filter list, but it
|
||||||
|
// is not configured.
|
||||||
|
ErrNotConfigured = errors.New("custom filter list not configured")
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -78,7 +82,10 @@ func start() error {
|
||||||
configChangeEvent,
|
configChangeEvent,
|
||||||
"update custom filter list",
|
"update custom filter list",
|
||||||
func(ctx context.Context, obj interface{}) error {
|
func(ctx context.Context, obj interface{}) error {
|
||||||
return checkAndUpdateFilterList()
|
if err := checkAndUpdateFilterList(); !errors.Is(err, ErrNotConfigured) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
},
|
},
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -100,7 +107,7 @@ func checkAndUpdateFilterList() error {
|
||||||
// Get path and return error if empty
|
// Get path and return error if empty
|
||||||
filePath := getFilePath()
|
filePath := getFilePath()
|
||||||
if filePath == "" {
|
if filePath == "" {
|
||||||
return fmt.Errorf("custom filter list setting is empty")
|
return ErrNotConfigured
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schedule next update check
|
// Schedule next update check
|
||||||
|
|
Loading…
Add table
Reference in a new issue