Repository navigation
Fix JSON encoding of custom column headers - #987
Open
dajiaohuang wants to merge 1 commit into
Open
dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
[[columns]] headeraccepts arbitrary strings, but--jsoninterpolates the header without JSON escaping. For example, a supported configuration containing:produces a field like
"Process "ID"": 201, so a JSON consumer cannot parse the output. Backslashes and control characters in custom headers have the same problem.Change
JSON-encode the header with
serde_json, retaining existing numeric/string value handling and the default key names. Declare the dependency directly so this also works with--no-default-features(the default Docker dependency already brings it into Cargo.lock). Add a platform-independent regression for ordinary headers, quotes, backslashes, newlines and tabs.Validation
--no-default-featureson Windows x86_64, Rust 1.98.1.View::filter/adjust/display: the quoted-header JSON failed on base and passes with this change. No host process table was collected.cargo fmt -- --checkpasses.cargo clippy -- -D warningsfails on five existing unnecessary casts insrc/columns/priority.rs:140–144; the unchanged base has identical diagnostics, with and without default features.