From cc648ecc776d77eee2215877b320324af0589305 Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Sun, 16 Jul 2023 16:51:28 +0200 Subject: [PATCH] Add some error checking to cli --share --- cli/kdeconnect-cli.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index 2093400e8..8db4f03ec 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -193,13 +193,15 @@ int main(int argc, char **argv) if (parser.isSet(QStringLiteral("share"))) { QStringList urls; - QUrl url = QUrl::fromUserInput(parser.value(QStringLiteral("share")), QDir::currentPath()); - urls.append(url.toString()); + QString firstArg = parser.value(QStringLiteral("share")); + const auto args = QStringList(firstArg) + parser.positionalArguments(); - // Check for more arguments - const auto args = parser.positionalArguments(); for (const QString &input : args) { QUrl url = QUrl::fromUserInput(input, QDir::currentPath()); + if (url.isEmpty()) { + qWarning() << "URL not valid:" << input; + continue; + } urls.append(url.toString()); }