From f7ce6890ec183cc6d287f34dc2d7fc8c5d914ed1 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 17 May 2024 16:29:39 +0200 Subject: [PATCH] fix(not found): check if subplebbitAddress is valid before displaying 'back to' buttton --- src/views/not-found/not-found.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/not-found/not-found.tsx b/src/views/not-found/not-found.tsx index 35b00a6f..150ef906 100644 --- a/src/views/not-found/not-found.tsx +++ b/src/views/not-found/not-found.tsx @@ -19,6 +19,7 @@ const NotFoundImage = () => { const NotFound = () => { const { subplebbitAddress } = useParams(); + const isValidSubplebbitAddress = !subplebbitAddress || subplebbitAddress.includes('.') || /^12D3K[a-zA-Z0-9]{44}$/.test(subplebbitAddress); const [theme, setTheme] = useTheme(); const previousThemeRef = useRef(theme); @@ -47,7 +48,7 @@ const NotFound = () => {
- {subplebbitAddress && ( + {subplebbitAddress && isValidSubplebbitAddress && ( <>