Fixed another QUrl weirdness were urls with empty credentials contained an unnecessary @ before the hostname

FossilOrigin-Name: 9f7b11b9ab0c210395f8aade55e8de0a3d212ae6
This commit is contained in:
Kostas
2015-09-15 10:39:11 +00:00
parent a71355cbec
commit 45740da630
5 changed files with 30 additions and 28 deletions

View File

@@ -525,6 +525,21 @@ QString UrlToStringNoCredentials(const QUrl& url)
return url.toString(QUrl::PrettyDecoded|QUrl::RemoveUserInfo);
#endif
}
//------------------------------------------------------------------------------
// Attempt to address weird behaviour of QUrl to string conversions
QString UrlToString(const QUrl &url)
{
QString username = url.userName();
// QUrl generates bad local file url for Windows local paths with drive letters
if(url.isLocalFile())
return url.toLocalFile();
else if(username.isEmpty()) // QUrl generates an invalid url like http://@host.domain/path
return UrlToStringNoCredentials(url);
else
return url.toEncoded();
}
//------------------------------------------------------------------------------
void SplitCommandLine(const QString &commandLine, QString &command, QString &extraParams)
{