fix(docker): create custom template [EE-4114] (#7812)

* EE-4114 fix(docker): create custom template

* Update customtemplate_create.go

remove white space
pull/6986/merge
Rex Wang 2 years ago committed by GitHub
parent 0219d41ba7
commit 3f51d077ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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) {

@ -83,9 +83,6 @@
<button type="button" class="btn btn-sm btn-primary" ngf-select ng-model="$ctrl.formValues.File"> Select file </button>
<span class="space-left">
{{ $ctrl.formValues.File.name }}
<span ng-if="$ctrl.formValues.File">
<pr-icon icon="'x'" feather="true" mode="'danger'"></pr-icon>
</span>
</span>
</div>
</div>

Loading…
Cancel
Save