mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go/internal/modload: treat \ as a path separator instead of a shell special character
According to the code comment, \ should be treated as a path separator. See fileNameOK in golang.org/x/mod/module/module.go. Change-Id: I05e05246005191ecccfecf46848aba5cb1359956 Reviewed-on: https://go-review.googlesource.com/c/go/+/310429 Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
b9dfaf77f5
commit
30002e6656
1 changed files with 1 additions and 1 deletions
|
|
@ -554,7 +554,7 @@ func checkModulePathLax(p string) error {
|
||||||
// with file systems and subcommands. Disallow file path separators : and \
|
// with file systems and subcommands. Disallow file path separators : and \
|
||||||
// because path separators other than / will confuse the module cache.
|
// because path separators other than / will confuse the module cache.
|
||||||
// See fileNameOK in golang.org/x/mod/module/module.go.
|
// See fileNameOK in golang.org/x/mod/module/module.go.
|
||||||
shellChars := "`" + `\"'*<>?|`
|
shellChars := "`" + `"'*<>?|`
|
||||||
fsChars := `\:`
|
fsChars := `\:`
|
||||||
if i := strings.IndexAny(p, shellChars); i >= 0 {
|
if i := strings.IndexAny(p, shellChars); i >= 0 {
|
||||||
return errorf("contains disallowed shell character %q", p[i])
|
return errorf("contains disallowed shell character %q", p[i])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue