forked from qt-creator/qt-creator
LSP: Do not use FullyEncoded in QUrl::toString
Change-Id: I8f978327a1d12f7d418a77ac4bc70b135142f989 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -403,13 +403,11 @@ Utils::Link Location::toLink() const
|
|||||||
if (!isValid(nullptr))
|
if (!isValid(nullptr))
|
||||||
return Utils::Link();
|
return Utils::Link();
|
||||||
|
|
||||||
// QUrl::FullyDecoded is not supported by QUrl::toString.
|
|
||||||
// Ensure %xx like %20 are really decoded using fromPercentEncoding
|
// Ensure %xx like %20 are really decoded using fromPercentEncoding
|
||||||
// Else, a path with spaces would keep its %20 which would cause failure
|
// Else, a path with spaces would keep its %20 which would cause failure
|
||||||
// to open the file by the text editor. This is the cases with compilers in
|
// to open the file by the text editor. This is the cases with compilers in
|
||||||
// C:\Programs Files on Windows.
|
// C:\Programs Files on Windows.
|
||||||
auto file = uri().toString(QUrl::FullyDecoded | QUrl::PreferLocalFile);
|
auto file = uri().toString(QUrl::PrettyDecoded | QUrl::PreferLocalFile);
|
||||||
|
|
||||||
// fromPercentEncoding convert %xx encoding to raw values and then interpret
|
// fromPercentEncoding convert %xx encoding to raw values and then interpret
|
||||||
// the result as utf-8, so toUtf8() must be used here.
|
// the result as utf-8, so toUtf8() must be used here.
|
||||||
file = QUrl::fromPercentEncoding(file.toUtf8());
|
file = QUrl::fromPercentEncoding(file.toUtf8());
|
||||||
|
Reference in New Issue
Block a user