Explorar o código

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 <derek@mcgstyle.net> (github: dmcgowan)
Derek McGowan %!s(int64=10) %!d(string=hai) anos
pai
achega
c8d2ec93ca
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      registry/session.go

+ 3 - 1
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)