@ -54,11 +54,8 @@ func (payload *settingsUpdatePayload) Validate(r *http.Request) error {
if payload . TemplatesURL != nil && * payload . TemplatesURL != "" && ! govalidator . IsURL ( * payload . TemplatesURL ) {
return errors . New ( "Invalid external templates URL. Must correspond to a valid URL format" )
}
if payload . HelmRepositoryURL != nil && * payload . HelmRepositoryURL != "" {
err := libhelm . ValidateHelmRepositoryURL ( * payload . HelmRepositoryURL )
if err != nil {
return errors . Wrap ( err , "Invalid Helm repository URL. Must correspond to a valid URL format" )
}
if payload . HelmRepositoryURL != nil && * payload . HelmRepositoryURL != "" && ! govalidator . IsURL ( * payload . HelmRepositoryURL ) {
return errors . New ( "Invalid Helm repository URL. Must correspond to a valid URL format" )
}
if payload . UserSessionTimeout != nil {
_ , err := time . ParseDuration ( * payload . UserSessionTimeout )
@ -114,7 +111,16 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) *
}
if payload . HelmRepositoryURL != nil {
settings . HelmRepositoryURL = strings . TrimSuffix ( strings . ToLower ( * payload . HelmRepositoryURL ) , "/" )
newHelmRepo := strings . TrimSuffix ( strings . ToLower ( * payload . HelmRepositoryURL ) , "/" )
if newHelmRepo != settings . HelmRepositoryURL && newHelmRepo != portainer . DefaultHelmRepositoryURL {
err := libhelm . ValidateHelmRepositoryURL ( * payload . HelmRepositoryURL )
if err != nil {
return & httperror . HandlerError { http . StatusBadRequest , "Invalid Helm repository URL. Must correspond to a valid URL format" , err }
}
}
settings . HelmRepositoryURL = newHelmRepo
}
if payload . BlackListedLabels != nil {