Browse code

Escape remote names on repo push/pull

shin- authored on 2013/06/06 00:54:33
Showing 1 changed files
... ...
@@ -409,7 +409,7 @@ func (srv *Server) ImagePull(name, tag, endpoint string, out io.Writer, sf *util
409 409
 	remote := name
410 410
 	parts := strings.Split(name, "/")
411 411
 	if len(parts) > 2 {
412
-		remote = fmt.Sprintf("src/%s", strings.Join(parts, "%2F"))
412
+		remote = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/")))
413 413
 	}
414 414
 	if err := srv.pullRepository(r, out, name, remote, tag, sf); err != nil {
415 415
 		return err
... ...
@@ -496,7 +496,7 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri
496 496
 	srvName := name
497 497
 	parts := strings.Split(name, "/")
498 498
 	if len(parts) > 2 {
499
-		srvName = fmt.Sprintf("src/%s", strings.Join(parts, "%2F"))
499
+		srvName = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/")))
500 500
 	}
501 501
 
502 502
 	repoData, err := r.PushImageJSONIndex(srvName, imgList, false)