Skip to content

fix sanitize config options - #4141

Merged
keith-hall merged 3 commits into
sharkdp:masterfrom
curious-rabbit:sanitize-modes
Nov 22, 2026
Merged

keith-hall merged 3 commits into
sharkdp:masterfrom
curious-rabbit:sanitize-modes

Conversation

@curious-rabbit

@curious-rabbit curious-rabbit commented Nov 19, 2026 •

Copy link
Copy Markdown

The --sanitize option has three possible values: never, auto and always but they do not behave as users may expect

It was originally modeled after --strip-ansi and intended to strip the dangerous sequences. Original discussions here and here

However the option was changed to instead replace the sequences and not strip them, so that possible dangerous content of a file is indicated safely with � and not hidden. The options still followed the reasoning of--strip-ansihowever, which caused auto to not sanitize plain text files (like --strip-ansi does) and always to ignore pipes.

This PR fixes the options to be much more intuitive:

--sanitize=auto always filters all files without exception when the output is a interactive terminal, and doesn't filter in piped mode, this aligns with how other options like --color behave as well.
--sanitize=always now filters always, including in piped mode

@curious-rabbit
curious-rabbit marked this pull request as draft November 19, 2026 17:44
@curious-rabbit
curious-rabbit marked this pull request as ready for review November 19, 2026 17:47
@curious-rabbit curious-rabbit changed the title improve sanitize options fix sanitize config options Nov 20, 2026
@keith-hall
keith-hall enabled auto-merge November 20, 2026 21:08
@keith-hall
keith-hall merged commit 4bd5c5b into sharkdp:master Nov 22, 2026
24 checks passed
cindykrafft pushed a commit to cindykrafft/bat that referenced this pull request Nov 23, 2026
Brings in sharkdp#4141, which moves line decoding in print_line into
decode_line(). No conflicts; the blank-line check for -b still runs on
the input before the line is rendered.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVn4SeAXPsUajXT2rtHQfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants