From 783c00b78cdcc279f4aae572aacfc07de47cc567 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 27 Dec 2016 20:22:20 +0100 Subject: [PATCH] Fix handling special chars like # in openLocalFileOrDir() --- misc/desktoputils.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/misc/desktoputils.cpp b/misc/desktoputils.cpp index a82b035..aec5f6e 100644 --- a/misc/desktoputils.cpp +++ b/misc/desktoputils.cpp @@ -16,9 +16,13 @@ bool openLocalFileOrDir(const QString &path) // -> replace backslashes with slashes to support Windows paths QString tmp(path); tmp.replace(QChar('\\'), QChar('/')); - return QDesktopServices::openUrl(QUrl(QStringLiteral("file:///") + path, QUrl::TolerantMode)); + QUrl url(QStringLiteral("file:///")); + url.setPath(tmp, QUrl::DecodedMode); + return QDesktopServices::openUrl(url); #else - return QDesktopServices::openUrl(QUrl(QStringLiteral("file://") + path, QUrl::TolerantMode)); + QUrl url(QStringLiteral("file://")); + url.setPath(path, QUrl::DecodedMode); + return QDesktopServices::openUrl(url); #endif }