mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(not found): check if subplebbitAddress is valid before displaying 'back to' buttton
This commit is contained in:
@@ -19,6 +19,7 @@ const NotFoundImage = () => {
|
|||||||
|
|
||||||
const NotFound = () => {
|
const NotFound = () => {
|
||||||
const { subplebbitAddress } = useParams();
|
const { subplebbitAddress } = useParams();
|
||||||
|
const isValidSubplebbitAddress = !subplebbitAddress || subplebbitAddress.includes('.') || /^12D3K[a-zA-Z0-9]{44}$/.test(subplebbitAddress);
|
||||||
|
|
||||||
const [theme, setTheme] = useTheme();
|
const [theme, setTheme] = useTheme();
|
||||||
const previousThemeRef = useRef(theme);
|
const previousThemeRef = useRef(theme);
|
||||||
@@ -47,7 +48,7 @@ const NotFound = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.boxContent}>
|
<div className={styles.boxContent}>
|
||||||
<NotFoundImage />
|
<NotFoundImage />
|
||||||
{subplebbitAddress && (
|
{subplebbitAddress && isValidSubplebbitAddress && (
|
||||||
<>
|
<>
|
||||||
<br />
|
<br />
|
||||||
<div className={styles.backToBoard}>
|
<div className={styles.backToBoard}>
|
||||||
|
|||||||
Reference in New Issue
Block a user