fix: filter all character dangerous sequences internally (#2459)

This commit is contained in:
valoq authored and GitHub committed 2026-03-24 11:58:58 +11:00
1 parent 644b8196bf
commit e363f76601
3 files changed
+31 -2

No files matched your search

+11
View File
@@ -934,6 +934,17 @@ func (nav *nav) preview(path string, win *win, mode string) {
if binary {
lines = []string{"\033[7mbinary\033[0m"}
}
// The internal previewer reads raw file content which may contain
// escape sequences that corrupt the display or enable code execution
// (e.g. OSC 52 clipboard writes). Strip all control characters.
if len(gOpts.previewer) == 0 && !binary {
sixel = false
for i, l := range lines {
lines[i] = stripAllSequences(l)
}
}
reg.lines = lines
reg.sixel = sixel
}