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 2022-10-20 16:42:49 +08:00 committed by GitHub
parent 0219d41ba7
commit 3f51d077ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -380,12 +380,14 @@ func (payload *customTemplateFromFileUploadPayload) Validate(r *http.Request) er
payload.FileContent = composeFileContent payload.FileContent = composeFileContent
varsString, _ := request.RetrieveMultiPartFormValue(r, "Variables", true) varsString, _ := request.RetrieveMultiPartFormValue(r, "Variables", true)
err = json.Unmarshal([]byte(varsString), &payload.Variables) if varsString != "" {
if err != nil { err = json.Unmarshal([]byte(varsString), &payload.Variables)
return errors.New("Invalid variables. Ensure that the variables are valid JSON") if err != nil {
return errors.New("Invalid variables. Ensure that the variables are valid JSON")
}
return validateVariablesDefinitions(payload.Variables)
} }
return nil
return validateVariablesDefinitions(payload.Variables)
} }
func (handler *Handler) createCustomTemplateFromFileUpload(r *http.Request) (*portainer.CustomTemplate, error) { func (handler *Handler) createCustomTemplateFromFileUpload(r *http.Request) (*portainer.CustomTemplate, error) {

View File

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