Strip all variables from command in OpenInFileManager

Fixes #674
This commit is contained in:
Jonas Kvinge 2021-03-29 22:37:55 +02:00
parent 36e597a045
commit 84b7fa02bb
1 changed files with 2 additions and 8 deletions

View File

@ -368,7 +368,8 @@ void OpenInFileManager(const QString path, const QUrl &url) {
if (setting.contains("Exec")) {
QString cmd = setting.value("Exec").toString();
if (cmd.isEmpty()) break;
command_params = cmd.split(' ');
cmd = cmd.remove(QRegularExpression("[%][a-z]*( |$)"));
command_params = cmd.split(' ', Qt::SkipEmptyParts);
command = command_params.first();
command_params.removeFirst();
}
@ -376,13 +377,6 @@ void OpenInFileManager(const QString path, const QUrl &url) {
if (!command.isEmpty()) break;
}
if (command_params.contains("%u")) {
command_params.removeAt(command_params.indexOf("%u"));
}
if (command_params.contains("%U")) {
command_params.removeAt(command_params.indexOf("%U"));
}
if (command.startsWith("/usr/bin/")) {
command = command.split("/").last();
}