From de148e9f9fe00f4a951f40e01b60bdb31fc70692 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 31 Jul 2023 12:18:27 +0200 Subject: [PATCH] [bugfix/frontend] Decode URI component domain before showing on frontend (#2043) --- web/source/settings/admin/federation/detail.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/source/settings/admin/federation/detail.js b/web/source/settings/admin/federation/detail.js index 0c6d29522..344b9f9b6 100644 --- a/web/source/settings/admin/federation/detail.js +++ b/web/source/settings/admin/federation/detail.js @@ -38,11 +38,14 @@ module.exports = function InstanceDetail({ baseUrl }) { const { data: blockedInstances = {}, isLoading } = query.useInstanceBlocksQuery(); let [_match, { domain }] = useRoute(`${baseUrl}/:domain`); - - if (domain == "view") { // from form field submission + if (domain == "view") { + // Retrieve domain from form field submission. domain = (new URL(document.location)).searchParams.get("domain"); } + // Normalize / decode domain (it may be URL-encoded). + domain = decodeURIComponent(domain); + const existingBlock = React.useMemo(() => { return blockedInstances[domain]; }, [blockedInstances, domain]);