This commit is contained in:
Wenkai Yin 2016-07-18 20:37:52 +08:00
parent 4b5098aeba
commit befc22f3f7

View File

@ -227,13 +227,19 @@ func (ra *RepositoryAPI) GetTags() {
ts, err := rc.ListTag() ts, err := rc.ListTag()
if err != nil { if err != nil {
if regErr, ok := err.(*registry_error.Error); ok { regErr, ok := err.(*registry_error.Error)
ra.CustomAbort(regErr.StatusCode, regErr.Detail) if !ok {
}
log.Errorf("error occurred while listing tags of %s: %v", repoName, err) log.Errorf("error occurred while listing tags of %s: %v", repoName, err)
ra.CustomAbort(http.StatusInternalServerError, "internal error") ra.CustomAbort(http.StatusInternalServerError, "internal error")
} }
// TODO remove the logic if the bug of registry is fixed
// It's a workaround for a bug of registry: when listing tags of
// a repository which is being pushed, a "NAME_UNKNOWN" error will
// been returned, while the catalog API can list this repository.
if regErr.StatusCode != http.StatusNotFound {
ra.CustomAbort(regErr.StatusCode, regErr.Detail)
}
}
tags = append(tags, ts...) tags = append(tags, ts...)