mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 11:46:40 +00:00
[bugfix/frontend] Decode URI component domain before showing on frontend (#2043)
This commit is contained in:
parent
a5a80b4bbe
commit
de148e9f9f
|
@ -38,11 +38,14 @@ module.exports = function InstanceDetail({ baseUrl }) {
|
||||||
const { data: blockedInstances = {}, isLoading } = query.useInstanceBlocksQuery();
|
const { data: blockedInstances = {}, isLoading } = query.useInstanceBlocksQuery();
|
||||||
|
|
||||||
let [_match, { domain }] = useRoute(`${baseUrl}/:domain`);
|
let [_match, { domain }] = useRoute(`${baseUrl}/:domain`);
|
||||||
|
if (domain == "view") {
|
||||||
if (domain == "view") { // from form field submission
|
// Retrieve domain from form field submission.
|
||||||
domain = (new URL(document.location)).searchParams.get("domain");
|
domain = (new URL(document.location)).searchParams.get("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normalize / decode domain (it may be URL-encoded).
|
||||||
|
domain = decodeURIComponent(domain);
|
||||||
|
|
||||||
const existingBlock = React.useMemo(() => {
|
const existingBlock = React.useMemo(() => {
|
||||||
return blockedInstances[domain];
|
return blockedInstances[domain];
|
||||||
}, [blockedInstances, domain]);
|
}, [blockedInstances, domain]);
|
||||||
|
|
Loading…
Reference in a new issue