diff --git a/src/ui/api/utils.go b/src/ui/api/utils.go index 6351daa32..f75268d1d 100644 --- a/src/ui/api/utils.go +++ b/src/ui/api/utils.go @@ -388,6 +388,29 @@ func diffRepos(reposInRegistry []string, reposInDB []string, if !exist { continue } + + endpoint, err := config.RegistryURL() + if err != nil { + log.Errorf("failed to get registry URL: %v", err) + continue + } + client, err := NewRepositoryClient(endpoint, true, + "admin", repoInR, "repository", repoInR, "pull") + if err != nil { + log.Errorf("failed to create repository client: %v", err) + continue + } + + exist, err = repositoryExist(repoInR, client) + if err != nil { + log.Errorf("failed to check the existence of repository %s: %v", repoInR, err) + continue + } + + if !exist { + continue + } + needsAdd = append(needsAdd, repoInR) }