summary refs log tree commit diff
path: root/src/ui/NhekoGlobalObject.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-10-17 17:18:02 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-10-17 17:18:14 +0200
commit147dc9d4da25707217bc22a27a4c2f19274ca03c (patch)
treec73fa6541fac7d9a85fe87e1b3baa44e53b0efe6 /src/ui/NhekoGlobalObject.cpp
parentWIP (diff)
downloadnheko-147dc9d4da25707217bc22a27a4c2f19274ca03c.tar.xz
Use allow list for URI schemes
Diffstat (limited to 'src/ui/NhekoGlobalObject.cpp')
-rw-r--r--src/ui/NhekoGlobalObject.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp

index 15f2a5af..a93466d2 100644 --- a/src/ui/NhekoGlobalObject.cpp +++ b/src/ui/NhekoGlobalObject.cpp
@@ -61,7 +61,17 @@ Nheko::openLink(QString link) const QUrl url(link); // Open externally if we couldn't handle it internally 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