mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Use allow list for URI schemes
This commit is contained in:
parent
b030eb923b
commit
147dc9d4da
1 changed files with 11 additions and 1 deletions
|
@ -61,7 +61,17 @@ Nheko::openLink(QString link) const
|
||||||
QUrl url(link);
|
QUrl url(link);
|
||||||
// Open externally if we couldn't handle it internally
|
// Open externally if we couldn't handle it internally
|
||||||
if (!ChatPage::instance()->handleMatrixUri(url)) {
|
if (!ChatPage::instance()->handleMatrixUri(url)) {
|
||||||
QDesktopServices::openUrl(url);
|
const QStringList allowedUrlSchemes = {
|
||||||
|
"http",
|
||||||
|
"https",
|
||||||
|
"mailto",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (allowedUrlSchemes.contains(url.scheme()))
|
||||||
|
QDesktopServices::openUrl(url);
|
||||||
|
else
|
||||||
|
nhlog::ui()->warn("Url '{}' not opened, because the scheme is not in the allow list",
|
||||||
|
url.toDisplayString().toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue