Commit 3f026830 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

don't construct invalid paths

tear this logic apart a bit to make it easier to comprehend. previously
it was trying to be too smart for its own good.

the previous code would url.todisplaystring (this returns a url if the
input was an url - e.g. file:///foo) but then used that with
fromLocalFile (which prepends file:/) ultimately ending up with

instead let's manipulate the path proper-like. append to the path(),
then simply pass along the url, no localfile conversion necessary at all

BUG: 428373
parent 3b316236
Pipeline #206604 passed with stage
in 1 minute and 4 seconds
......@@ -588,8 +588,15 @@ uint FileChooserPortal::SaveFile(const QDBusObjectPath &handle,
if (!currentName.isEmpty()) {
const QUrl url = fileDialog->m_fileWidget->baseUrl();
fileDialog->m_fileWidget->setSelectedUrl(QUrl::fromLocalFile(QStringLiteral("%1/%2").arg(url.toDisplayString(QUrl::StripTrailingSlash), currentName)));
QUrl url = fileDialog->m_fileWidget->baseUrl();
QString path = url.path();
if (path.back() == QLatin1Char('/')) {
path = path + currentName;
} else {
path = path + QLatin1Char('/') + currentName;
if (!acceptLabel.isEmpty()) {
Supports Markdown
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