Skip to content

mime-settings: Properly quote command parameters

Gaël Bonithon requested to merge Tamaranch/xfce4-settings:fix-quoting into master

Here is a proposal based on the conventions currently used in .desktop files: the fact that an argument must be quoted is signified by the use of double quotes (and only double quotes), with no possibility of escaping these quotes.

I don't know if there are any use cases that currently go beyond this, but there will have to be limits at some point if we want to get away with it. Besides there is already code that adds or removes double quotes in xfce-mime-helper.c, so I guess that's a reasonable assumption.

Here are the steps:

  • split by isolating the parts to be quoted;
  • remove the double quotes;
  • replace %s with the parameter;
  • quote properly;
  • join.

Fixes: #390 (closed), #403 (closed)

Merge request reports

Loading