From e89bb932eafe5ed752e7e446d4bc683d37eadac1 Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Fri, 15 Jan 2021 20:11:43 -0500 Subject: [PATCH] Fix pattern issue --- pattern/pattern.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pattern/pattern.go b/pattern/pattern.go index 1eaef3b1..91d26ed6 100644 --- a/pattern/pattern.go +++ b/pattern/pattern.go @@ -10,10 +10,11 @@ func Match(pattern, s string) bool { if pattern == "*" { return true } - // Backslashes break filepath.Match, so we'll remove all of them. - // This has a pretty significant impact on performance when there - // are backslashes, but at least it doesn't break filepath.Match. - s = strings.ReplaceAll(s, "\\", "") + // Separators found in the string break filepath.Match, so we'll remove all of them. + // This has a pretty significant impact on performance when there are separators in + // the strings, but at least it doesn't break filepath.Match. + s = strings.ReplaceAll(s, string(filepath.Separator), "") + pattern = strings.ReplaceAll(pattern, string(filepath.Separator), "") matched, _ := filepath.Match(pattern, s) return matched }