custom action %d expansion produces erroneous results if "%" in path
thunar 4.6.10, debian bookworm (testing)
In thunar, Edit, Configure custom actions...
+ (add a new custom action)
Basic
name: expansion issue
Description: demonstrate issue with percent expansion when there are percents in names
Command: echo %f ! %F ! %d ! %D ! %n ! %N >/tmp/expansion-result.txt
Appearance Conditions
File Pattern: *
Text Files: checked
at command prompt:
mkdir "/tmp/100% Energy"
touch "/tmp/100% Energy/test-expansion.txt"
Open thunar to "/tmp/100% Energy/", highlight test-expansion.txt, right-click, expansion issue
cat /tmp/expansion-result.txt
/tmp/100% Energy/test-expansion.txt ! /tmp/100% Energy/test-expansion.txt ! /tmp/100Energy ! /tmp/100Energy ! test-expansion.txt ! test-expansion.txt
Both %d and %D produce wrong results, with the "% " in the path removed. In contrast %f and %F do not remove "% " from the path.
rename /tmp/100% Energy to /tmp/100 Energy
Open thunar to "/tmp/100 Energy/", highlight test-expansion.txt, right-click, expansion issue
cat /tmp/expansion-result.txt
/tmp/100 Energy/test-expansion.txt ! /tmp/100 Energy/test-expansion.txt ! /tmp/100 Energy ! /tmp/100 Energy ! test-expansion.txt ! test-expansion.txt
Here both %d and %D are expanded correctly.