Commit cd6c7375 authored by Jani Monoses's avatar Jani Monoses Committed by Gustavo Niemeyer

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
parent 6edfd2d3
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment