forked from TrueCloudLab/distribution
Prevent loop with var overshadowing
Incase of a 3xx redirect the var was being overshowed and ever changed causing an infinite loop. Fixes #9480 Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
df85a0f700
commit
3911c8b8dc
1 changed files with 3 additions and 2 deletions
|
@ -505,7 +505,7 @@ func (r *Session) PushImageJSONIndex(remote string, imgList []*ImgData, validate
|
|||
// Redirect if necessary
|
||||
for res.StatusCode >= 300 && res.StatusCode < 400 {
|
||||
log.Debugf("Redirected to %s", res.Header.Get("Location"))
|
||||
req, err = r.reqFactory.NewRequest("PUT", res.Header.Get("Location"), bytes.NewReader(imgListJSON))
|
||||
req, err := r.reqFactory.NewRequest("PUT", res.Header.Get("Location"), bytes.NewReader(imgListJSON))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -515,10 +515,11 @@ func (r *Session) PushImageJSONIndex(remote string, imgList []*ImgData, validate
|
|||
if validate {
|
||||
req.Header["X-Docker-Endpoints"] = regs
|
||||
}
|
||||
res, _, err := r.doRequest(req)
|
||||
redirect, _, err := r.doRequest(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = redirect
|
||||
defer res.Body.Close()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue