From 10dc5d1f1d2162eabcc4b79bdc05e919c16c46bb Mon Sep 17 00:00:00 2001 From: Yuming He Date: Wed, 22 Jul 2026 12:06:52 +0800 Subject: [PATCH] fix(launch): split QUrl scheme check for empty vs file scheme QUrl::toLocalFile() returns empty string when scheme is not "file", so a bare path like "/tmp/foo" (empty scheme) was silently collapsed to "" instead of being preserved as-is. Separate the two cases so only file:// URLs get converted to local paths. Signed-off-by: Yuming He --- src/dbus/applicationservice.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/dbus/applicationservice.cpp b/src/dbus/applicationservice.cpp index ce2ce5cf..7a76fda0 100644 --- a/src/dbus/applicationservice.cpp +++ b/src/dbus/applicationservice.cpp @@ -560,7 +560,6 @@ QDBusObjectPath ApplicationService::Launch(const QString &action, const QStringL formattedRes.append(value.value()); } - auto newLoc = task.argNum; if (task.local) { for (auto it = formattedRes.begin(); it != formattedRes.end();) { const QUrl url{*it}; @@ -571,8 +570,10 @@ QDBusObjectPath ApplicationService::Launch(const QString &action, const QStringL shouldErase = true; } else { const auto scheme = url.scheme(); - if (scheme == "file" || scheme.isEmpty()) { + if (scheme == "file") { *it = url.toLocalFile(); + } else if (scheme.isEmpty()) { + // nothing to do } else { // TODO: Remote file handling logic qWarning() << "Remote file not supported yet, skipping:" << *it; @@ -582,8 +583,8 @@ QDBusObjectPath ApplicationService::Launch(const QString &action, const QStringL if (shouldErase) { auto curLoc = std::distance(formattedRes.begin(), it); - if (curLoc < newLoc) { - --newLoc; + if (curLoc < task.argNum) { + --task.argNum; } it = formattedRes.erase(it); } else { @@ -591,8 +592,6 @@ QDBusObjectPath ApplicationService::Launch(const QString &action, const QStringL } } } - - task.argNum = newLoc; } int originalIndex{0};