]> Sergey Matveev's repositories - nnn.git/commit
feat(preview-tui): handle quoting in start_preview more robustly
authormusjj <72612857+musjj@users.noreply.github.com>
Wed, 19 Apr 2023 01:20:41 +0000 (08:20 +0700)
committermusjj <72612857+musjj@users.noreply.github.com>
Wed, 19 Apr 2023 01:20:41 +0000 (08:20 +0700)
commit432b0755d33f5d7c0f9e085939338aa0644c17e9
tree130c5a376ee90eb47cd13f10d541a491397793de
parent621dbba02e8d4ee12d196b350da8fa24e2cb6908
feat(preview-tui): handle quoting in start_preview more robustly

This commit makes the script more resistant to naughty filenames.
The script now depends on bash for the following features:
- Arrays
Correctly creating and passing argument lists is now simple
- Parameter transformation
`${parameter@Q}` makes it easy to correctly quote a string so that it
can be safely re-evaluated by the interpreter later.

On iTerm, the shell command used to render the preview is now passed to
osascript via a named pipe: `$FIFO_OSASCRIPT`. By not embedding the
shell command directly, we now no longer need to worry about osascript's
quoting rules. It's not perfect, because $SHELL and $TMPDIR might
contain naughty characters, but it's quite unlikely to happen.
plugins/preview-tui