-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Escape non-printable characters in user output #7831
Conversation
Replaces control characters and non-printable characters with escape sequences, in any fields that are printed by the CLI, which could have been user input. Output from `ipfs cat` is unchanged.
065f5c0
to
7193f95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left a few small comments it'd be nice to fix up before merging.
core/commands/cmdenv/env.go
Outdated
// EscNonPrint converts non-printable characters and backslash into Go | ||
// escape sequences, if the given string contains any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about adding a comment that we're trying to mimic the escape quoting style from https://www.gnu.org/software/coreutils/manual/html_node/Formatting-the-file-names.html?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link says essentially what the comment here says, so I don't think it adds much, other than it hints that we are doing this for the same reason. Also, I fear that people will misread that and think it means identical content.
Added brief description of purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, if/when we add other escaping options we can add more descriptions
Replaces control characters and non-printable characters with escape sequences, in any fields that are printed by the CLI, which could have been user input.
Output from
ipfs cat
is unchanged.