Skip to content

Commit

Permalink
Adjust truncated output
Browse files Browse the repository at this point in the history
  • Loading branch information
dehort committed Sep 6, 2024
1 parent b81323f commit cc5b346
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/validator/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ func (this *handler) validateContent(ctx context.Context, requestType string, da
log.Debug("Payload too big. Truncating payload.")
}

var truncated string = "Truncated..."

lines := strings.Split(string(data), "\n")

for i, line := range lines {
Expand All @@ -193,8 +195,8 @@ func (this *handler) validateContent(ctx context.Context, requestType string, da

if i > 500 && truncateData {
if validatedEvent.Console != nil || *validatedEvent.Console != "" {
var truncated string = "Truncated..."
validatedEvent.Console = &truncated
truncated = ""
}
}

Expand All @@ -207,8 +209,8 @@ func (this *handler) validateContent(ctx context.Context, requestType string, da
}

if i > 500 && i < len(lines)-2 && truncateData {
var truncated string = "Truncated..."
validatedEvent.Stdout = &truncated
truncated = ""
}

events.Playbook = append(events.Playbook, *validatedEvent)
Expand Down

0 comments on commit cc5b346

Please sign in to comment.