diff --git a/src/controller/application.cpp b/src/controller/application.cpp
index 7af1df26..cb6cfbe6 100644
--- a/src/controller/application.cpp
+++ b/src/controller/application.cpp
@@ -60,6 +60,15 @@ Application::Application(int& argc, char** argv, const QString& name) :
installTranslator(translator);
loadTranslations();
+ auto list = QUrl::idnWhitelist();
+ list.append({
+ QStringLiteral("fi"),
+ QStringLiteral("ee"),
+ QStringLiteral("lt"),
+ QStringLiteral("lv"),
+ });
+ QUrl::setIdnWhitelist(list);
+
for (const QString& font : QDir(QStringLiteral(":/fonts")).entryList()) {
QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/%1").arg(font));
}
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 1870a02d..b1c0786f 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -1,7 +1,6 @@
add_library(ui STATIC
certificatewidget.cpp
certificatewidget.hpp
- punycode.hpp
ui.cpp
webeiddialog.cpp
webeiddialog.hpp
diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui
index 6d222049..9fbad301 100644
--- a/src/ui/dialog.ui
+++ b/src/ui/dialog.ui
@@ -513,6 +513,9 @@ border-radius: 4px;
Qt::TabFocus
+
+ Qt::PlainText
+
@@ -586,6 +589,9 @@ border-radius: 4px;
Qt::TabFocus
+
+ Qt::PlainText
+
diff --git a/src/ui/punycode.hpp b/src/ui/punycode.hpp
deleted file mode 100644
index 053ea04e..00000000
--- a/src/ui/punycode.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2020-2024 Estonian Information System Authority
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#pragma once
-
-#include
-#include
-
-inline QString fromPunycode(const QUrl& punycodeUrl)
-{
- QUrl url {punycodeUrl};
- // QUrl::PrettyDecoded only decodes Punycode on select trusted domains like .com, .org etc.
- // We need to work around that restriction in order to support EU national domains like .fi,
- // .ee, .lv, .lt etc.
- url.setHost(url.host() + QStringLiteral(".com"), QUrl::TolerantMode);
- const auto host = url.host(QUrl::PrettyDecoded);
- return QStringLiteral("%2%3").arg(host.mid(0, host.size() - 4),
- url.port() == -1 ? QString()
- : QStringLiteral(":%1").arg(url.port()));
-}
diff --git a/src/ui/webeiddialog.cpp b/src/ui/webeiddialog.cpp
index 4f381ed8..75eeef62 100644
--- a/src/ui/webeiddialog.cpp
+++ b/src/ui/webeiddialog.cpp
@@ -22,7 +22,6 @@
#include "webeiddialog.hpp"
#include "application.hpp"
-#include "punycode.hpp"
#include "ui_dialog.h"
@@ -43,8 +42,6 @@
#include
#endif
-#include
-
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
constexpr inline QLatin1String operator"" _L1(const char* str, size_t size) noexcept
{
@@ -336,7 +333,7 @@ void WebEidDialog::onSmartCardStatusUpdate(const RetriableError status)
void WebEidDialog::onMultipleCertificatesReady(
const QUrl& origin, const std::vector& certAndPinInfos)
{
- ui->selectCertificateOriginLabel->setText(fromPunycode(origin));
+ ui->selectCertificateOriginLabel->setText(origin.host(QUrl::PrettyDecoded));
setupCertificateAndPinInfo(certAndPinInfos);
switch (currentCommand) {
@@ -390,7 +387,7 @@ void WebEidDialog::onMultipleCertificatesReady(
void WebEidDialog::onSingleCertificateReady(const QUrl& origin,
const EidCertificateAndPinInfo& certAndPinInfo)
{
- ui->selectCertificateOriginLabel->setText(fromPunycode(origin));
+ ui->selectCertificateOriginLabel->setText(origin.host(QUrl::PrettyDecoded));
ui->pinInputOriginLabel->setText(ui->selectCertificateOriginLabel->text());
const bool useExternalPinDialog = certAndPinInfo.eid->providesExternalPinDialog();
diff --git a/tests/tests/main.cpp b/tests/tests/main.cpp
index 270164c5..beb5ee4a 100644
--- a/tests/tests/main.cpp
+++ b/tests/tests/main.cpp
@@ -26,8 +26,6 @@
#include "controller.hpp"
#include "command-handlers/getcertificate.hpp"
-#include "../ui/punycode.hpp"
-
#include "mock-ui.hpp"
#include "getcommandhandler-mock.hpp"
@@ -72,8 +70,6 @@ private slots:
void authenticate_validArgumentsResultInValidToken();
- void fromPunycode_decodesEeDomain();
-
void quit_exits();
private:
@@ -201,12 +197,6 @@ void WebEidTests::authenticate_validArgumentsResultInValidToken()
QStringLiteral("MIIEAzCCA2WgAwIBAgIQOWkBW"));
}
-void WebEidTests::fromPunycode_decodesEeDomain()
-{
- QCOMPARE(fromPunycode(QUrl(QStringLiteral("https://xn--igusnunik-p7af.ee"))),
- QStringLiteral("\u00F5igusn\u00F5unik.ee"));
-}
-
void WebEidTests::quit_exits()
{
try {