forked from qt-creator/qt-creator
FilePath: Fix setFromString for short urls
FilePath::setFromString failed previously for URLs without a path, e.g. "http://qt.io" as it would add the scheme and host to its path. Also added a test for various URLs Change-Id: I6c22489c0af7154734390aa1e5e12693864210b1 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -875,7 +875,8 @@ void FilePath::setFromString(const QString &filename, OsType osType)
|
||||
m_scheme = filename.left(schemeEnd);
|
||||
const auto hostEnd = filename.indexOf(slash, schemeEnd + 3);
|
||||
m_host = filename.mid(schemeEnd + 3, hostEnd - schemeEnd - 3);
|
||||
setRootAndPath(QStringView(filename).mid(hostEnd), osType);
|
||||
if (hostEnd != -1)
|
||||
setRootAndPath(QStringView(filename).mid(hostEnd), osType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user