1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:34:39 -07:00

x/mod/module: accept trailing slash in MatchPrefixPattern

Trailing slash of glob is not accepted in MatchPrefixPattern.

close #48513
This commit is contained in:
HowJMay 2021-09-21 23:55:26 +08:00
parent 7d67f8d435
commit 9c4d9fa40c

View File

@ -811,6 +811,10 @@ func MatchPrefixPatterns(globs, target string) bool {
continue
}
// Remove the trailing slash in glob
if glob[len(glob)-1] == '/' {
glob = glob[:len(glob)-1]
}
// A glob with N+1 path elements (N slashes) needs to be matched
// against the first N+1 path elements of target,
// which end just before the N+1'th slash.