@@ -64,7 +64,6 @@ type HTTPOptions struct {
6464
6565 // TTL for an idle conn per transport
6666 IdleConnTimeout int
67-
6867 // If the URL is https, then we need to configure this client
6968 // with the usual TLS stuff
7069 // Defaults are /etc/grid-security/hostcert.pem and /etc/grid-security/hostkey.pem
@@ -228,9 +227,11 @@ func (c *EOSHTTPClient) buildFullURL(urlpath string, auth eosclient.Authorizatio
228227 }
229228 }
230229
230+ urlpathEncoded := strings .ReplaceAll (url .PathEscape (urlpath ), "%2F" , "/" )
231+
231232 fullurl := strings .TrimRight (c .opt .BaseURL , "/" )
232233 fullurl += "/"
233- fullurl += strings .TrimLeft (urlpath , "/" )
234+ fullurl += strings .TrimLeft (urlpathEncoded , "/" )
234235
235236 if pos < 0 {
236237 fullurl += "?"
@@ -244,7 +245,7 @@ func (c *EOSHTTPClient) buildFullURL(urlpath string, auth eosclient.Authorizatio
244245
245246 u , err := url .Parse (fullurl )
246247 if err != nil {
247- return "" , errtypes .PermissionDenied ("Could not parse url " + urlpath )
248+ return "" , errtypes .PermissionDenied ("Could not parse url " + urlpathEncoded )
248249 }
249250
250251 final := strings .ReplaceAll (u .String (), "#" , "%23" )
@@ -380,11 +381,11 @@ func (c *EOSHTTPClient) PUTFile(ctx context.Context, remoteuser string, auth eos
380381 log .Info ().Str ("func" , "PUTFile" ).Str ("remoteuser" , remoteuser ).Str ("uid,gid" , auth .Role .UID + "," + auth .Role .GID ).Str ("path" , urlpath ).Int64 ("length" , length ).Str ("app" , app ).Msg ("" )
381382
382383 // Now send the req and see what happens
383- tempUrl , err := c .buildFullURL (urlpath , auth )
384+ tempURL , err := c .buildFullURL (urlpath , auth )
384385 if err != nil {
385386 return err
386387 }
387- base , err := url .Parse (tempUrl )
388+ base , err := url .Parse (tempURL )
388389 if err != nil {
389390 return errtypes .PermissionDenied ("Could not parse url " + urlpath )
390391 }
0 commit comments