Merge pull request #2386 from northtyphoon/bindu/acr-push-location
docker/pusher: handle location string containing path and query
This commit is contained in:
commit
437e90aa5e
@ -155,9 +155,18 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten
|
|||||||
location := resp.Header.Get("Location")
|
location := resp.Header.Get("Location")
|
||||||
// Support paths without host in location
|
// Support paths without host in location
|
||||||
if strings.HasPrefix(location, "/") {
|
if strings.HasPrefix(location, "/") {
|
||||||
u := p.base
|
// Support location string containing path and query
|
||||||
u.Path = location
|
qmIndex := strings.Index(location, "?")
|
||||||
location = u.String()
|
if qmIndex > 0 {
|
||||||
|
u := p.base
|
||||||
|
u.Path = location[:qmIndex]
|
||||||
|
u.RawQuery = location[qmIndex+1:]
|
||||||
|
location = u.String()
|
||||||
|
} else {
|
||||||
|
u := p.base
|
||||||
|
u.Path = location
|
||||||
|
location = u.String()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err = http.NewRequest(http.MethodPut, location, nil)
|
req, err = http.NewRequest(http.MethodPut, location, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user