Commit 0b82b48c authored by vaikas-google's avatar vaikas-google

clean up the code for fetching registries

parent 3db24d85
......@@ -244,7 +244,7 @@ func (tr *typeResolver) ShortTypeToDownloadURLs(template string) ([]string, erro
if len(m) != 6 {
return []string{}, fmt.Errorf("Failed to parse short github url: %s", template)
}
r, err := tr.rp.GetRegistry("github.com/" + m[1] + "/" + m[2])
r, err := tr.rp.GetRegistry(template)
if err != nil {
return []string{}, err
}
......@@ -262,7 +262,7 @@ func (tr *typeResolver) ShortTypeToPackageDownloadURLs(template string) ([]strin
if len(m) != 4 {
return []string{}, fmt.Errorf("Failed to parse short github url: %s", template)
}
r, err := tr.rp.GetRegistry("github.com/" + m[1] + "/" + m[2])
r, err := tr.rp.GetRegistry(template)
if err != nil {
return []string{}, err
}
......
......@@ -70,7 +70,7 @@ func (rs *inmemRepositoryService) Delete(name string) error {
// GetByURL returns a registry that handles the types for a given URL.
func (rs *inmemRepositoryService) GetByURL(URL string) (*common.Registry, error) {
for _, r := range rs.repositories {
if strings.HasPrefix(r.URL, URL) {
if strings.HasPrefix(URL, r.URL) {
return r, nil
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment