@@ -34,10 +34,11 @@ import (
3434 "path/filepath"
3535 "strings"
3636
37- "github.com/rogpeppe/go-internal/module"
37+ "golang.org/x/mod/module"
38+ "golang.org/x/mod/semver"
39+ "golang.org/x/tools/txtar"
40+
3841 "github.com/rogpeppe/go-internal/par"
39- "github.com/rogpeppe/go-internal/semver"
40- "github.com/rogpeppe/go-internal/txtar"
4142)
4243
4344type Server struct {
@@ -110,12 +111,12 @@ func (srv *Server) readModList() error {
110111 continue
111112 }
112113 encPath := strings .Replace (name [:i ], "_" , "/" , - 1 )
113- path , err := module .DecodePath (encPath )
114+ path , err := module .UnescapePath (encPath )
114115 if err != nil {
115116 return fmt .Errorf ("cannot decode module path in %q: %v" , name , err )
116117 }
117118 encVers := name [i + 1 :]
118- vers , err := module .DecodeVersion (encVers )
119+ vers , err := module .UnescapeVersion (encVers )
119120 if err != nil {
120121 return fmt .Errorf ("cannot decode module version in %q: %v" , name , err )
121122 }
@@ -138,7 +139,7 @@ func (srv *Server) handler(w http.ResponseWriter, r *http.Request) {
138139 return
139140 }
140141 enc , file := path [:i ], path [i + len ("/@v/" ):]
141- path , err := module .DecodePath (enc )
142+ path , err := module .UnescapePath (enc )
142143 if err != nil {
143144 fmt .Fprintf (os .Stderr , "go proxy_test: %v\n " , err )
144145 http .NotFound (w , r )
@@ -166,7 +167,7 @@ func (srv *Server) handler(w http.ResponseWriter, r *http.Request) {
166167 return
167168 }
168169 encVers , ext := file [:i ], file [i + 1 :]
169- vers , err := module .DecodeVersion (encVers )
170+ vers , err := module .UnescapeVersion (encVers )
170171 if err != nil {
171172 fmt .Fprintf (os .Stderr , "go proxy_test: %v\n " , err )
172173 http .NotFound (w , r )
@@ -274,12 +275,12 @@ func (srv *Server) findHash(m module.Version) string {
274275}
275276
276277func (srv * Server ) readArchive (path , vers string ) * txtar.Archive {
277- enc , err := module .EncodePath (path )
278+ enc , err := module .EscapePath (path )
278279 if err != nil {
279280 fmt .Fprintf (os .Stderr , "go proxy: %v\n " , err )
280281 return nil
281282 }
282- encVers , err := module .EncodeVersion (vers )
283+ encVers , err := module .EscapeVersion (vers )
283284 if err != nil {
284285 fmt .Fprintf (os .Stderr , "go proxy: %v\n " , err )
285286 return nil
0 commit comments