Browse Source

godeps: bump go-etcd to 6aa2da5

Yicheng Qin 11 years ago
parent
commit
dc863459f8

+ 2 - 2
Godeps/Godeps.json

@@ -16,8 +16,8 @@
 		},
 		},
 		{
 		{
 			"ImportPath": "github.com/coreos/go-etcd/etcd",
 			"ImportPath": "github.com/coreos/go-etcd/etcd",
-			"Comment": "v0.2.0-rc1-127-g6fe04d5",
-			"Rev": "6fe04d580dfb71c9e34cbce2f4df9eefd1e1241e"
+			"Comment": "v0.2.0-rc1-130-g6aa2da5",
+			"Rev": "6aa2da5a7a905609c93036b9307185a04a5a84a5"
 		},
 		},
 		{
 		{
 			"ImportPath": "github.com/jonboulle/clockwork",
 			"ImportPath": "github.com/jonboulle/clockwork",

+ 4 - 2
Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/requests.go

@@ -379,11 +379,13 @@ func buildValues(value string, ttl uint64) url.Values {
 	return v
 	return v
 }
 }
 
 
-// convert key string to http path exclude version
+// convert key string to http path exclude version, including URL escaping
 // for example: key[foo] -> path[keys/foo]
 // for example: key[foo] -> path[keys/foo]
+// key[/%z] -> path[keys/%25z]
 // key[/] -> path[keys/]
 // key[/] -> path[keys/]
 func keyToPath(key string) string {
 func keyToPath(key string) string {
-	p := path.Join("keys", key)
+	// URL-escape our key, except for slashes
+	p := strings.Replace(url.QueryEscape(path.Join("keys", key)), "%2F", "/", -1)
 
 
 	// corner case: if key is "/" or "//" ect
 	// corner case: if key is "/" or "//" ect
 	// path join will clear the tailing "/"
 	// path join will clear the tailing "/"

+ 22 - 0
Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/requests_test.go

@@ -0,0 +1,22 @@
+package etcd
+
+import "testing"
+
+func TestKeyToPath(t *testing.T) {
+	tests := []struct {
+		key   string
+		wpath string
+	}{
+		{"", "keys/"},
+		{"foo", "keys/foo"},
+		{"foo/bar", "keys/foo/bar"},
+		{"%z", "keys/%25z"},
+		{"/", "keys/"},
+	}
+	for i, tt := range tests {
+		path := keyToPath(tt.key)
+		if path != tt.wpath {
+			t.Errorf("#%d: path = %s, want %s", i, path, tt.wpath)
+		}
+	}
+}