From 84b7fa02bb736da7a29189699292d1a060f5959a Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Mon, 29 Mar 2021 22:37:55 +0200 Subject: [PATCH] Strip all variables from command in OpenInFileManager Fixes #674 --- src/core/utilities.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 08a9377f2..4df4233b7 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -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(); }