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

chore(portainer): clean up the code EE-5188 (#8660)

This commit is contained in:
andres-portainer 2023-03-13 13:18:28 -03:00 committed by GitHub
parent 621a01ba3b
commit 15cbdb8af9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 111 additions and 65 deletions

View file

@ -63,6 +63,7 @@ func (handler *Handler) ifRequestedTemplateExists(payload *filePayload) *httperr
return nil
}
}
return httperror.InternalServerError("Invalid template", errors.New("requested template does not exist"))
}
@ -82,6 +83,7 @@ func (handler *Handler) ifRequestedTemplateExists(payload *filePayload) *httperr
// @router /templates/file [post]
func (handler *Handler) templateFile(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
var payload filePayload
err := request.DecodeAndValidateJSONPayload(r, &payload)
if err != nil {
return httperror.BadRequest("Invalid request payload", err)
@ -112,11 +114,9 @@ func (handler *Handler) templateFile(w http.ResponseWriter, r *http.Request) *ht
}
func (handler *Handler) cleanUp(projectPath string) error {
func (handler *Handler) cleanUp(projectPath string) {
err := handler.FileService.RemoveDirectory(projectPath)
if err != nil {
log.Debug().Err(err).Msg("HTTP error: unable to cleanup stack creation")
}
return nil
}