Fix glob in exclude check.

This commit is contained in:
GRMrGecko 2024-08-09 13:17:57 -05:00
parent 810cebadd9
commit 44cd195109

View File

@ -18,7 +18,7 @@ import (
const (
serviceName = "nginx-cache-purge"
serviceDescription = "Tool to help purge Nginx cache "
serviceVersion = "0.1.3"
serviceVersion = "0.1.4"
)
// App structure to access global app variables.
@ -43,7 +43,7 @@ func (a *App) PurgeCache(CachePath string, Key string, ExcludeKeys []string) err
for _, exclude := range ExcludeKeys {
if globRegex.MatchString(exclude) {
g, err := glob.Compile(exclude)
if err != nil && g != nil && g.Match(Key) {
if err == nil && g != nil && g.Match(Key) {
return true
}
}