From befc22f3f7d00e2cd9638f7763d39d4ed0427efc Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Mon, 18 Jul 2016 20:37:52 +0800 Subject: [PATCH] fix #561 --- api/repository.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/api/repository.go b/api/repository.go index a962c9dbc..8de2f2bcc 100644 --- a/api/repository.go +++ b/api/repository.go @@ -227,12 +227,18 @@ func (ra *RepositoryAPI) GetTags() { ts, err := rc.ListTag() if err != nil { - if regErr, ok := err.(*registry_error.Error); ok { + regErr, ok := err.(*registry_error.Error) + if !ok { + log.Errorf("error occurred while listing tags of %s: %v", repoName, err) + 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) } - - log.Errorf("error occurred while listing tags of %s: %v", repoName, err) - ra.CustomAbort(http.StatusInternalServerError, "internal error") } tags = append(tags, ts...)