Merge pull request #7758 from ywk253100/190509_bug_fix

Fixes bug in replication
This commit is contained in:
Wenkai Yin 2019-05-10 16:49:19 +08:00 committed by GitHub
commit 7ee9063c2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -136,7 +136,7 @@ func (a *adapter) getChartInfo(name, version string) (*chartVersionDetail, error
if err != nil { if err != nil {
return nil, err return nil, err
} }
url := fmt.Sprintf("%s/api/chartrepo/%s/charts/%s/%s", a.getURL(), project, name, version) url := fmt.Sprintf("%s/api/chartrepo/%s/charts/%s/%s", a.url, project, name, version)
info := &chartVersionDetail{} info := &chartVersionDetail{}
if err = a.client.Get(url, info); err != nil { if err = a.client.Get(url, info); err != nil {
return nil, err return nil, err
@ -159,7 +159,7 @@ func (a *adapter) DownloadChart(name, version string) (io.ReadCloser, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
url = fmt.Sprintf("%s/chartrepo/%s/%s", a.getURL(), project, url) url = fmt.Sprintf("%s/chartrepo/%s/%s", a.url, project, url)
} }
req, err := http.NewRequest(http.MethodGet, url, nil) req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil { if err != nil {
@ -189,7 +189,7 @@ func (a *adapter) UploadChart(name, version string, chart io.Reader) error {
} }
w.Close() w.Close()
url := fmt.Sprintf("%s/api/chartrepo/%s/charts", a.getURL(), project) url := fmt.Sprintf("%s/api/chartrepo/%s/charts", a.url, project)
req, err := http.NewRequest(http.MethodPost, url, buf) req, err := http.NewRequest(http.MethodPost, url, buf)
if err != nil { if err != nil {
@ -220,7 +220,7 @@ func (a *adapter) DeleteChart(name, version string) error {
if err != nil { if err != nil {
return err return err
} }
url := fmt.Sprintf("%s/api/chartrepo/%s/charts/%s/%s", a.getURL(), project, name, version) url := fmt.Sprintf("%s/api/chartrepo/%s/charts/%s/%s", a.url, project, name, version)
return a.client.Delete(url) return a.client.Delete(url)
} }

View File

@ -146,7 +146,7 @@ func (a *adapter) listCandidateProjects(filters []*model.Filter) ([]*project, er
// override the default implementation from the default image registry // override the default implementation from the default image registry
// by calling Harbor API directly // by calling Harbor API directly
func (a *adapter) DeleteManifest(repository, reference string) error { func (a *adapter) DeleteManifest(repository, reference string) error {
url := fmt.Sprintf("%s/api/repositories/%s/tags/%s", a.getURL(), repository, reference) url := fmt.Sprintf("%s/api/repositories/%s/tags/%s", a.url, repository, reference)
return a.client.Delete(url) return a.client.Delete(url)
} }