1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 14:59:41 +02:00

fix(template): app template v3 error [BE-11998] (#854)

This commit is contained in:
Oscar Zhou 2025-07-05 02:49:33 +12:00 committed by GitHub
parent 8ffe4e284a
commit c20a8b5a68
6 changed files with 21 additions and 19 deletions

View file

@ -40,11 +40,13 @@ func (handler *Handler) fetchTemplates() (*listResponse, *httperror.HandlerError
}
defer resp.Body.Close()
err = json.NewDecoder(resp.Body).Decode(&body)
if err != nil {
if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
return nil, httperror.InternalServerError("Unable to parse template file", err)
}
for i := range body.Templates {
body.Templates[i].ID = portainer.TemplateID(i + 1)
}
return body, nil
}