diff --git a/part/part.cpp b/part/part.cpp --- a/part/part.cpp +++ b/part/part.cpp @@ -206,10 +206,11 @@ return; } - const QUrl url(localPath); + const QUrl url = QUrl::fromUserInput(localPath, QString()); KIO::StatJob* statJob = nullptr; - if (!url.scheme().isEmpty()) { + // Try to resolve the URL to a local path. + if (!url.isLocalFile() && !url.scheme().isEmpty()) { statJob = KIO::mostLocalUrl(url); if (!statJob->exec() || statJob->error() != 0) { @@ -220,6 +221,13 @@ const QString destination = statJob ? statJob->statResult().stringValue(KIO::UDSEntry::UDS_LOCAL_PATH) : localPath; delete statJob; + // The URL could not be resolved to a local path. + if (!url.isLocalFile() && destination.isEmpty()) { + qCWarning(ARK) << "Ark cannot extract to non-local destination:" << localPath; + KMessageBox::sorry(widget(), xi18nc("@info", "Ark can only extract to local destinations.")); + return; + } + qCDebug(ARK) << "Extract to" << destination; Kerfuffle::ExtractionOptions options;