Skip to content

fix: replace invalid utf-8 sequences in agent logs #13436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: replace invalid utf-8 sequences in agent logs
Fixes #13433.
  • Loading branch information
kylecarbs committed Jun 3, 2024
commit 432898337071dc71e3efa9012c01c70e4e60b7a4
2 changes: 1 addition & 1 deletion codersdk/agentsdk/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func ProtoFromLog(log Log) (*proto.Log, error) {
}
return &proto.Log{
CreatedAt: timestamppb.New(log.CreatedAt),
Output: log.Output,
Output: strings.ToValidUTF8(log.Output, ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably replace invalid utf-8 with something, so it's obvious data is being deleted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we get cute and replace with something like ❌ or 😞 or 🤬, or just something like <<invalid UTF-8>>?

Level: proto.Log_Level(lvl),
}, nil
}
Expand Down
Loading