mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
fix(docker): create custom template [EE-4114] (#7812)
* EE-4114 fix(docker): create custom template * Update customtemplate_create.go remove white space
This commit is contained in:
parent
0219d41ba7
commit
3f51d077ac
2 changed files with 7 additions and 8 deletions
|
@ -380,12 +380,14 @@ func (payload *customTemplateFromFileUploadPayload) Validate(r *http.Request) er
|
|||
payload.FileContent = composeFileContent
|
||||
|
||||
varsString, _ := request.RetrieveMultiPartFormValue(r, "Variables", true)
|
||||
err = json.Unmarshal([]byte(varsString), &payload.Variables)
|
||||
if err != nil {
|
||||
return errors.New("Invalid variables. Ensure that the variables are valid JSON")
|
||||
if varsString != "" {
|
||||
err = json.Unmarshal([]byte(varsString), &payload.Variables)
|
||||
if err != nil {
|
||||
return errors.New("Invalid variables. Ensure that the variables are valid JSON")
|
||||
}
|
||||
return validateVariablesDefinitions(payload.Variables)
|
||||
}
|
||||
|
||||
return validateVariablesDefinitions(payload.Variables)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (handler *Handler) createCustomTemplateFromFileUpload(r *http.Request) (*portainer.CustomTemplate, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue