Add some error checking to cli --share

This commit is contained in:
Albert Vaca Cintora 2023-07-16 16:51:28 +02:00
parent 1956af935f
commit cc648ecc77

View file

@ -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());
}