Skip to content

Commit

Permalink
fix: prefix no longer dropped by sanitizer on input step start (#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
graza-io authored Feb 22, 2024
1 parent 819d0b6 commit e59349f
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions internal/types/parsed_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ func NewParsedEvent(prefix ParsedEventPrefix, executionId string, eventType stri
}

func (p ParsedEvent) String(sanitizer *sanitize.Sanitizer, opts sanitize.RenderOptions) string {
//// deliberately shadow the receiver with a sanitized version of the struct
//var err error
//if p, err = sanitize.SanitizeStruct(sanitizer, p); err != nil {
// return ""
//}

pre := p.ParsedEventPrefix.String(sanitize.NullSanitizer, opts)
out := ""
pre := p.ParsedEventPrefix.String(sanitizer, opts)

// deliberately shadow the receiver with a sanitized version of the struct
var err error
if p, err = sanitize.SanitizeStruct(sanitizer, p); err != nil {
return out
}

out += fmt.Sprintf("%s %s\n", pre, p.Message)
return out
Expand All @@ -235,15 +235,15 @@ func NewParsedEventWithInput(pe ParsedEvent, input map[string]any, isSkip bool)

func (p ParsedEventWithInput) String(sanitizer *sanitize.Sanitizer, opts sanitize.RenderOptions) string {
au := aurora.NewAurora(opts.ColorEnabled)
pre := p.ParsedEventPrefix.String(sanitize.NullSanitizer, opts)
out := ""

// deliberately shadow the receiver with a sanitized version of the struct
var err error
if p, err = sanitize.SanitizeStruct(sanitizer, p); err != nil {
return ""
return out
}

out := ""
pre := p.ParsedEventPrefix.String(sanitizer, opts)

if p.isSkip {
return fmt.Sprintf("%s %s\n", pre, au.BrightBlack("Skipped"))
}
Expand Down Expand Up @@ -304,15 +304,14 @@ func NewParsedEventWithOutput(parsedEvent ParsedEvent, output map[string]any, st

func (p ParsedEventWithOutput) String(sanitizer *sanitize.Sanitizer, opts sanitize.RenderOptions) string {
au := aurora.NewAurora(opts.ColorEnabled)
pre := p.ParsedEventPrefix.String(sanitize.NullSanitizer, opts)
out := ""
// deliberately shadow the receiver with a sanitized version of the struct
var err error
if p, err = sanitize.SanitizeStruct(sanitizer, p); err != nil {
return ""
return out
}

out := ""
pre := p.ParsedEventPrefix.String(sanitizer, opts)

// attributes
if opts.Verbose && len(p.Output) > 0 {
out += sortAndParseMap(p.Output, "Attr", pre, au, opts)
Expand Down Expand Up @@ -371,14 +370,15 @@ func NewParsedErrorEvent(parsedEvent ParsedEvent, errors []modconfig.StepError,

func (p ParsedErrorEvent) String(sanitizer *sanitize.Sanitizer, opts sanitize.RenderOptions) string {
au := aurora.NewAurora(opts.ColorEnabled)
pre := p.ParsedEventPrefix.String(sanitize.NullSanitizer, opts)
out := ""

// deliberately shadow the receiver with a sanitized version of the struct
var err error
if p, err = sanitize.SanitizeStruct(sanitizer, p); err != nil {
return ""
return out
}

out := ""
pre := p.ParsedEventPrefix.String(sanitizer, opts)
duration := ""
if p.Duration != nil {
duration = *p.Duration
Expand Down

0 comments on commit e59349f

Please sign in to comment.