Only compile regex portion of folder filter

The code was trying to compile the `~` as well. In this case, it was
trying to match a literal `~` to the front of the supplied regex.

Fixes: 334ca89bea ("folder filter: only assume regex if filter is
~fmt")

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
This commit is contained in:
Daniel Xu 2019-08-19 22:10:48 -07:00 committed by Drew DeVault
parent 334ca89bea
commit 6fcc047c31

View file

@ -165,7 +165,7 @@ func folderMatches(folder string, pattern string) bool {
return false
}
if pattern[0] == '~' {
r, err := regexp.Compile(pattern)
r, err := regexp.Compile(pattern[1:])
if err != nil {
return false
}