forked from qt-creator/qt-creator
Git: Check remote port for isValid in GitRemote
Change-Id: Iab922abcde0ac055417467f3c63a31dffa721986 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
0dfb2938ed
commit
96f982a016
@@ -3403,12 +3403,13 @@ GitRemote::GitRemote(const QString &url)
|
|||||||
if (!match.hasMatch())
|
if (!match.hasMatch())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
protocol = match.captured("protocol");
|
protocol = match.captured("protocol");
|
||||||
userName = match.captured("user");
|
userName = match.captured("user");
|
||||||
host = match.captured("host");
|
host = match.captured("host");
|
||||||
port = match.captured("port").toUShort();
|
port = match.captured("port").toUShort(&ok);
|
||||||
path = match.captured("path");
|
path = match.captured("path");
|
||||||
isValid = true;
|
isValid = ok || match.captured("port").isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -1599,6 +1599,12 @@ void GitPlugin::testGitRemote_data()
|
|||||||
.host("code.qt.io")
|
.host("code.qt.io")
|
||||||
.port(80)
|
.port(80)
|
||||||
.path("/qt-creator/qt-creator.git");
|
.path("/qt-creator/qt-creator.git");
|
||||||
|
QTest::newRow("invalid-port")
|
||||||
|
<< RemoteTest("https://code.qt.io:99999/qt-creator/qt-creator.git")
|
||||||
|
.protocol("https")
|
||||||
|
.host("code.qt.io")
|
||||||
|
.path("/qt-creator/qt-creator.git")
|
||||||
|
.isValid(false);
|
||||||
QTest::newRow("ssh-user-foo")
|
QTest::newRow("ssh-user-foo")
|
||||||
<< RemoteTest("ssh://foo@codereview.qt-project.org:29418/qt-creator/qt-creator.git")
|
<< RemoteTest("ssh://foo@codereview.qt-project.org:29418/qt-creator/qt-creator.git")
|
||||||
.protocol("ssh")
|
.protocol("ssh")
|
||||||
|
Reference in New Issue
Block a user