mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(pending post page): prevent crash and ensure redirect to "not found" on invalid URL
This commit is contained in:
@@ -63,7 +63,7 @@ const BoardHeader = () => {
|
||||
? shortAddress.endsWith('.eth') || shortAddress.endsWith('.sol')
|
||||
? shortAddress.slice(0, -4)
|
||||
: shortAddress
|
||||
: Plebbit.getShortAddress(subplebbitAddress))}
|
||||
: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress))}
|
||||
{(isOffline || isOnlineStatusLoading) && !isInAllView && !isInSubscriptionsView && !isInModView && (
|
||||
<span className={styles.offlineIconWrapper}>
|
||||
<Tooltip content={offlineTitle}>
|
||||
|
||||
@@ -14,13 +14,10 @@ const PendingPost = () => {
|
||||
|
||||
const isValidAccountCommentIndex =
|
||||
!accountCommentIndex ||
|
||||
// Check if it's a valid positive integer
|
||||
(!isNaN(parseInt(accountCommentIndex)) &&
|
||||
parseInt(accountCommentIndex) >= 0 &&
|
||||
Number.isInteger(parseFloat(accountCommentIndex)) &&
|
||||
// Allow index to be at most 1 position beyond the current length
|
||||
// This handles the case where a new post is being created
|
||||
(accountComments?.length === 0 || parseInt(accountCommentIndex) <= accountComments.length));
|
||||
(accountComments?.length === 0 || parseInt(accountCommentIndex) < accountComments.length));
|
||||
|
||||
useEffect(() => {
|
||||
if (!isValidAccountCommentIndex) {
|
||||
|
||||
Reference in New Issue
Block a user