File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package codeowners
2
2
3
3
import (
4
4
"fmt"
5
- "os "
5
+ "path/filepath "
6
6
"regexp"
7
7
"strings"
8
8
)
@@ -32,6 +32,9 @@ func newPattern(patternStr string) (pattern, error) {
32
32
33
33
// match tests if the path provided matches the pattern
34
34
func (p pattern ) match (testPath string ) (bool , error ) {
35
+ // Normalize Windows-style path separators to forward slashes
36
+ testPath = filepath .ToSlash (testPath )
37
+
35
38
if p .leftAnchoredLiteral {
36
39
prefix := p .pattern
37
40
@@ -51,7 +54,7 @@ func (p pattern) match(testPath string) (bool, error) {
51
54
}
52
55
53
56
// Otherwise check if the test path is a subdirectory of the pattern
54
- if len (testPath ) > len (prefix ) && testPath [len (prefix )] == os . PathSeparator {
57
+ if len (testPath ) > len (prefix ) && testPath [len (prefix )] == '/' {
55
58
return testPath [:len (prefix )] == prefix , nil
56
59
}
57
60
You can’t perform that action at this time.
0 commit comments