sbarex / SourceCodeSyntaxHighlight

Quick Look extension for highlight source code files on macOS 10.15 and later.
GNU General Public License v3.0
2.88k stars 72 forks source link

Render file fail if path contain $ / " #180

Closed nella17 closed 2 years ago

nella17 commented 2 years ago

https://github.com/sbarex/SourceCodeSyntaxHighlight/blob/334e01e976e443268c726843ffcb34baed2f1602/Application/resources/colorize.sh#L80-L86

$targetHL need sanitize before cat it.

Syntax Highlight: colorize.sh failed with exit code 1. Command was ('/Applications/Syntax Highlight.app/Contents/Resources/highlight/colorize.sh' '/private/tmp/w$u/x.cpp').

command: '/Applications/Syntax Highlight.app/Contents/Resources/highlight/colorize.sh' '/private/tmp/w$u/x.cpp'
exitCode: 1

log dump: 
2022-06-15 11:28:36.044 Start processing /private/tmp/w$u/x.cpp …
2022-06-15 11:28:36.045 Detected UTI: public.c-plus-plus-source
2022-06-15 11:28:36.046 Highlight dataDir: /Applications/Syntax Highlight.app/Contents/Resources/highlight/share
2022-06-15 11:28:36.047 Highlight theme: /Applications/Syntax Highlight.app/Contents/Resources/highlight/share/themes/base16/material-darker
2022-06-15 11:28:36.047 CSS: /Applications/Syntax Highlight.app/Contents/Resources/highlight/style2.css
2022-06-15 11:28:36.047 Max data: 8388608
2022-06-15 11:28:36.047 EOL conversion: off
2022-06-15 11:28:36.047 Start colorizing /private/tmp/w$u/x.cpp …
2022-06-15 11:28:36.048 Executing '/Applications/Syntax Highlight.app/Contents/Resources/highlight/colorize.sh' '/private/tmp/w$u/x.cpp'
2022-06-15 11:28:36.000 Starting colorize.sh
2022-06-15 11:28:36.000 # install gdate with `brew install coreutils` to show the nanoseconds time stamp #
2022-06-15 11:28:36.000 Target to colorize: /private/tmp/w$u/x.cpp
2022-06-15 11:28:36.000 Resolved to language: cpp
2022-06-15 11:28:36.000 Reader: cat "/private/tmp/w$u/x.cpp"
2022-06-15 11:28:36.000 Highlight: /Applications/Syntax Highlight.app/Contents/Resources/highlight/bin/highlight
2022-06-15 11:28:36.000 Save reader output to a temporary file: /var/folders/4g/qt_8nwjs3ds4f39dmyh9_pjm0000gn/T/colorize.tpejfte7
2022-06-15 11:28:36.000 $ cat "/private/tmp/w$u/x.cpp" > "/var/folders/4g/qt_8nwjs3ds4f39dmyh9_pjm0000gn/T/colorize.tpejfte7"
cat: /private/tmp/w/x.cpp: No such file or directory
2022-06-15 11:28:36.000 Error 1!
2022-06-15 11:28:36.074 ERROR: colorize.sh failed with exit code 1: 
2022-06-15 11:28:36.074 
sbarex commented 2 years ago

Fixed on release 2.1.14.