mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
ApplicationProvider: more quotes handling (#1742)
This commit is contained in:
@@ -526,6 +526,25 @@ Item {
|
||||
Qt.callLater(() => {
|
||||
Logger.d("ApplicationsProvider", `Launching: ${app.name} (App ID: ${app.id || "unknown"})`);
|
||||
|
||||
const execString = (app.exec !== undefined && app.exec !== null) ? String(app.exec) : "";
|
||||
const commandArgs = Array.isArray(app.command) ? app.command : (app.command && app.command.length !== undefined) ? Array.from(app.command) : [];
|
||||
let hasQuotedArgs = execString.includes("\"") || execString.includes("'");
|
||||
let hasSpaceArgs = false;
|
||||
if (!hasQuotedArgs) {
|
||||
hasQuotedArgs = commandArgs.some(arg => {
|
||||
const text = String(arg);
|
||||
return text.includes("\"") || text.includes("'");
|
||||
});
|
||||
}
|
||||
if (!hasSpaceArgs) {
|
||||
hasSpaceArgs = commandArgs.some(arg => String(arg).includes(" "));
|
||||
}
|
||||
if (app.execute && (hasQuotedArgs || hasSpaceArgs)) {
|
||||
Logger.w("ApplicationsProvider", `Detected quoted/space arguments in Exec for ${app.name}, using app.execute()`);
|
||||
app.execute();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.data.appLauncher.customLaunchPrefixEnabled && Settings.data.appLauncher.customLaunchPrefix) {
|
||||
// Use custom launch prefix
|
||||
const prefix = Settings.data.appLauncher.customLaunchPrefix.split(" ");
|
||||
|
||||
Reference in New Issue
Block a user