Skip to content

Commit ca97e3c

Browse files
committed
Add more warnings for suspicious urls.
1 parent ef30c77 commit ca97e3c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Telegram/SourceFiles/overview/overview_layout.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,11 @@ Link::Link(
14331433
}
14341434
}
14351435

1436+
const auto createHandler = [](const QString &url) {
1437+
return UrlClickHandler::IsSuspicious(url)
1438+
? std::make_shared<HiddenUrlClickHandler>(url)
1439+
: std::make_shared<UrlClickHandler>(url);
1440+
};
14361441
_page = media ? media->webpage() : nullptr;
14371442
if (_page) {
14381443
mainUrl = _page->url;
@@ -1442,21 +1447,21 @@ Link::Link(
14421447
parent->fullId());
14431448
} else if (_page->photo) {
14441449
if (_page->type == WebPageType::Profile || _page->type == WebPageType::Video) {
1445-
_photol = std::make_shared<UrlClickHandler>(_page->url);
1450+
_photol = createHandler(_page->url);
14461451
} else if (_page->type == WebPageType::Photo
14471452
|| _page->siteName == qstr("Twitter")
14481453
|| _page->siteName == qstr("Facebook")) {
14491454
_photol = std::make_shared<PhotoOpenClickHandler>(
14501455
_page->photo,
14511456
parent->fullId());
14521457
} else {
1453-
_photol = std::make_shared<UrlClickHandler>(_page->url);
1458+
_photol = createHandler(_page->url);
14541459
}
14551460
} else {
1456-
_photol = std::make_shared<UrlClickHandler>(_page->url);
1461+
_photol = createHandler(_page->url);
14571462
}
14581463
} else if (!mainUrl.isEmpty()) {
1459-
_photol = std::make_shared<UrlClickHandler>(mainUrl);
1464+
_photol = createHandler(mainUrl);
14601465
}
14611466
if (from >= till && _page) {
14621467
text = _page->description.text;

0 commit comments

Comments
 (0)