1
0
mirror of https://github.com/golang/go synced 2024-11-21 19:04:44 -07:00

goinstall: allow packages from launchpad.net/~user branches.

The permitted filename characters should include ~ to allow
the names of user-owned branches in Launchpad.

R=golang-dev, rsc, n13m3y3r, gustavo
CC=golang-dev, gustavo.niemeyer
https://golang.org/cl/5280052
This commit is contained in:
Jani Monoses 2011-11-04 15:07:34 -04:00 committed by Gustavo Niemeyer
parent 6edfd2d35b
commit cd6c7375d4

View File

@ -109,7 +109,7 @@ func makeMakefile(dir, pkg string, tree *build.Tree, isCmd bool) ([]byte, error)
return buf.Bytes(), nil
}
var safeBytes = []byte("+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz")
var safeBytes = []byte("+-~./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz")
func safeName(s string) bool {
if s == "" {
@ -118,6 +118,9 @@ func safeName(s string) bool {
if strings.Contains(s, "..") {
return false
}
if s[0] == '~' {
return false
}
for i := 0; i < len(s); i++ {
if c := s[i]; c < 0x80 && bytes.IndexByte(safeBytes, c) < 0 {
return false