[s]ftp urls can be suspicious as well.
This commit is contained in:
parent
6451ae5074
commit
30d223befe
1 changed files with 2 additions and 2 deletions
|
|
@ -71,13 +71,13 @@ void UrlClickHandler::Open(QString url, QVariant context) {
|
||||||
|
|
||||||
bool UrlClickHandler::IsSuspicious(const QString &url) {
|
bool UrlClickHandler::IsSuspicious(const QString &url) {
|
||||||
static const auto Check1 = QRegularExpression(
|
static const auto Check1 = QRegularExpression(
|
||||||
"^(https?://)?([^/#\\:]+)([/#\\:]|$)",
|
"^((https?|s?ftp)://)?([^/#\\:]+)([/#\\:]|$)",
|
||||||
QRegularExpression::CaseInsensitiveOption);
|
QRegularExpression::CaseInsensitiveOption);
|
||||||
const auto match1 = Check1.match(url);
|
const auto match1 = Check1.match(url);
|
||||||
if (!match1.hasMatch()) {
|
if (!match1.hasMatch()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto domain = match1.capturedRef(2);
|
const auto domain = match1.capturedRef(3);
|
||||||
static const auto Check2 = QRegularExpression("^(.*)\\.[a-zA-Z]+$");
|
static const auto Check2 = QRegularExpression("^(.*)\\.[a-zA-Z]+$");
|
||||||
const auto match2 = Check2.match(domain);
|
const auto match2 = Check2.match(domain);
|
||||||
if (!match2.hasMatch()) {
|
if (!match2.hasMatch()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue