Join GitHub today
%p does not escape single quotes properly #32
I have a file name:
I have configured a custom cleanup action, named "Open file in default application". The command for this is:
When I click this cleanup action from the context menu on the file, I get a new window with the cleanup output:
cd /data/Google Drive/Media/Divers
This window does not show if the cleanup action runs succesfully. The cleanup action works with files that do not contain single quotes in their filename.
I'm using MATE and this is detected by QDirStat, which falls back to the default terminal emulator xterm.
QDirStat had always escaped such single quotes, but not the way common shells (Bash, Zsh) expect it: They don't want a backslash in front of that embedded single quote. Rather, you need to terminate the string with a single quote, start a new one with double quotes only containing the embedded single quote, and then re-open the old string.
Yikes. This is so utterly broken by design I can't find proper words for it. I just wonder how much other software is out there that does it the way most people would expect it: Trying to use a backslash to escape that embedded single quote (
Of course, such file names should be avoided entirely, but you can't help some slightly broken MP3 ripper program doing it, so it needs to be handled correctly.
Fixed with c8da4e8.
As is the case so often, the answer was on Stack Overflow: http://stackoverflow.com/questions/1250079/how-to-escape-single-quotes-within-single-quoted-strings