Commit a4bc6256 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

properly build URLs for local files that may have special characters

if the name or the path of a local file needs escaping,
QUrl::fromLocalFile should be used
parent 710275fd
......@@ -68,8 +68,16 @@ void FileBrowserProxyModel::listRecursiveNewEntries(KIO::Job *job, const KIO::UD
}
auto returnedPath = oneEntry.stringValue(KIO::UDSEntry::UDS_NAME);
auto fullPath = QStringLiteral("%0/%1").arg(mCurentUrl.toString(), returnedPath);
auto fullPathUrl = QUrl { fullPath };
auto fullPath = QString{};
auto fullPathUrl = QUrl{};
if (mCurentUrl.isLocalFile()) {
fullPath = QStringLiteral("%0/%1").arg(mCurentUrl.toLocalFile(), returnedPath);
fullPathUrl = QUrl::fromLocalFile(fullPath);
} else {
fullPath = QStringLiteral("%0/%1").arg(mCurentUrl.toString(), returnedPath);
fullPathUrl = QUrl{fullPath};
}
auto mimeType = mMimeDatabase.mimeTypeForUrl(fullPathUrl);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment