weldr: use source.Id instead of .Name for keys

This commit is contained in:
Lars Karlitski 2019-09-14 13:57:50 +02:00
parent 2ee12e2b51
commit f0e2e3786f

View file

@ -133,7 +133,7 @@ func (api *API) sourceListHandler(writer http.ResponseWriter, request *http.Requ
}
json.NewEncoder(writer).Encode(reply{
Sources: []string{api.repo.Name},
Sources: []string{api.repo.Id},
})
}
@ -155,7 +155,7 @@ func (api *API) sourceInfoHandler(writer http.ResponseWriter, request *http.Requ
// we only have one repository
names := strings.Split(params.ByName("sources"), ",")
if names[0] != api.repo.Name && names[0] != "*" {
if names[0] != api.repo.Id && names[0] != "*" {
statusResponseError(writer, http.StatusBadRequest, "repository not found: "+names[0])
return
}
@ -180,7 +180,7 @@ func (api *API) sourceInfoHandler(writer http.ResponseWriter, request *http.Requ
}
json.NewEncoder(writer).Encode(reply{
Sources: map[string]sourceConfig{cfg.Name: cfg},
Sources: map[string]sourceConfig{cfg.Id: cfg},
})
}