From c8d2ec93caf7c64f3e510e4e75f49614880ed9b9 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Sun, 22 Mar 2015 18:15:18 -0700 Subject: [PATCH] Add check for 404 on get repository data No longer add the body to the error when a 404 is received on get repository data. closes #11510 Signed-off-by: Derek McGowan (github: dmcgowan) --- registry/session.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registry/session.go b/registry/session.go index 470aeab4cb..82338252eb 100644 --- a/registry/session.go +++ b/registry/session.go @@ -280,7 +280,9 @@ func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error) { } // TODO: Right now we're ignoring checksums in the response body. // In the future, we need to use them to check image validity. - if res.StatusCode != 200 { + if res.StatusCode == 404 { + return nil, utils.NewHTTPRequestError(fmt.Sprintf("HTTP code: %d", res.StatusCode), res) + } else if res.StatusCode != 200 { errBody, err := ioutil.ReadAll(res.Body) if err != nil { log.Debugf("Error reading response body: %s", err)