diff --git a/v2/internal/runner/options.go b/v2/internal/runner/options.go index f901e9e05..61864cbfc 100644 --- a/v2/internal/runner/options.go +++ b/v2/internal/runner/options.go @@ -82,7 +82,7 @@ func validateOptions(options *types.Options) error { if !options.TemplateList { // Check if a list of templates was provided and it exists - if len(options.Templates) == 0 && len(options.Workflows) == 0 && len(options.Tags) == 0 && !options.UpdateTemplates { + if len(options.Templates) == 0 && !options.NewTemplates && len(options.Workflows) == 0 && len(options.Tags) == 0 && !options.UpdateTemplates { return errors.New("no template/templates provided") } } diff --git a/v2/pkg/protocols/headless/engine/page_actions.go b/v2/pkg/protocols/headless/engine/page_actions.go index 927523991..36c532e21 100644 --- a/v2/pkg/protocols/headless/engine/page_actions.go +++ b/v2/pkg/protocols/headless/engine/page_actions.go @@ -244,7 +244,9 @@ func (p *Page) Screenshot(act *Action, out map[string]string) error { to := act.GetArg("to") if to == "" { to = ksuid.New().String() - out[act.Name] = to + if act.Name != "" { + out[act.Name] = to + } } var data []byte var err error @@ -354,7 +356,9 @@ func (p *Page) GetResource(act *Action, out map[string]string) error { if err != nil { return errors.Wrap(err, "could not get src for element") } - out[act.Name] = string(resource) + if act.Name != "" { + out[act.Name] = string(resource) + } return nil } @@ -394,13 +398,17 @@ func (p *Page) ExtractElement(act *Action, out map[string]string) error { if err != nil { return errors.Wrap(err, "could not get attribute") } - out[act.Name] = *attrValue + if act.Name != "" { + out[act.Name] = *attrValue + } default: text, err := element.Text() if err != nil { return errors.Wrap(err, "could not get element text node") } - out[act.Name] = text + if act.Name != "" { + out[act.Name] = text + } } return nil } diff --git a/v2/pkg/protocols/headless/operators.go b/v2/pkg/protocols/headless/operators.go index f1845a89e..1d7ebb041 100644 --- a/v2/pkg/protocols/headless/operators.go +++ b/v2/pkg/protocols/headless/operators.go @@ -62,7 +62,7 @@ func (r *Request) Extract(data map[string]interface{}, extractor *extractors.Ext } // responseToDSLMap converts a DNS response to a map for use in DSL matching -func (r *Request) responseToDSLMap(resp, req, host, matched string) output.InternalEvent { +func (r *Request) responseToDSLMap(resp, req string, host, matched string) output.InternalEvent { data := make(output.InternalEvent, 5) // Some data regarding the request metadata