Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

backend/repository: assume no v2 on unexpected status #214

Merged
merged 1 commit into from
Oct 24, 2016

Conversation

lucab
Copy link
Contributor

@lucab lucab commented Oct 23, 2016

This commit changes version detection behavior to align with
Registry v2 specs:

If 404 Not Found response status, or other unexpected status,
is returned, the client should proceed with the assumption
that the registry does not implement V2 of the API.

Reference: https://docs.docker.com/registry/spec/api/#/api-version-check

Fixes #85

return false, nil
}

return false, fmt.Errorf("unexpected http code: %d", statusCode)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a compilation failure, since there is nothing returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local build+test seems fine (go 1.6.3), but I see over-zealous checkers may get confused. I'll switch to a false-return at the bottom.

This commit changes version detection behavior to align with
Registry v2 specs:

```
If 404 Not Found response status, or other unexpected status,
is returned, the client should proceed with the assumption
that the registry does not implement V2 of the API.
```

Reference: https://docs.docker.com/registry/spec/api/#/api-version-check
@lucab lucab force-pushed the to-upstream/registry-v2-check branch from 5267ab9 to 3c4ca52 Compare October 23, 2016 21:30
@lucab
Copy link
Contributor Author

lucab commented Oct 23, 2016

@s-urbaniak rebased, PTAL.

@jonboulle
Copy link
Contributor

LGTM

Copy link

@s-urbaniak s-urbaniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants