~sircmpwn/aerc

config: proper error handle [filters] config v1 PROPOSED

wagner riffel: 1
 config: proper error handle [filters] config

 1 files changed, 4 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/21931/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] config: proper error handle [filters] config Export this patch

Instead of panic when compiling a regular expression, return it up
Signed-off-by: wagner riffel <w@104d.net>
---
 config/config.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/config/config.go b/config/config.go
index 8b409fe..8032201 100644
--- a/config/config.go
+++ b/config/config.go
@@ -304,7 +304,7 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
				filter.Header = strings.ToLower(header)
				filter.Regex, err = regexp.Compile(regex)
				if err != nil {
					panic(err)
					return err
				}
			} else if strings.ContainsRune(match, ',') {
				filter.FilterType = FILTER_HEADER
@@ -312,6 +312,9 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
				value := filter.Filter[strings.Index(filter.Filter, ",")+1:]
				filter.Header = strings.ToLower(header)
				filter.Regex, err = regexp.Compile(regexp.QuoteMeta(value))
				if err != nil {
					return err
				}
			} else {
				filter.FilterType = FILTER_MIMETYPE
			}
-- 
2.30.2