Skip to content

Commit

Permalink
Merge pull request #1427 from oasisprotocol/lw/redirect-fixup
Browse files Browse the repository at this point in the history
Fix account redirection logic for checksum capitalized addresses
  • Loading branch information
lukaw3d authored May 23, 2024
2 parents 65efc51 + 44df0d1 commit 09cac2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .changelog/1427.trivial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix account redirection logic for checksum capitalized addresses
6 changes: 3 additions & 3 deletions src/app/pages/SearchResultsPage/useRedirectIfSingleResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RouteUtils } from '../../utils/route-utils'
import { isItemInScope, SearchScope } from '../../../types/searchScope'
import { Network } from '../../../types/network'
import { exhaustedTypeWarning } from '../../../types/errors'
import { Account, RuntimeAccount } from '../../../oasis-nexus/api'
import { RuntimeAccount } from '../../../oasis-nexus/api'
import { SearchParams } from '../../components/Search/search-utils'

/** If search only finds one result then redirect to it */
Expand Down Expand Up @@ -41,9 +41,9 @@ export function useRedirectIfSingleResult(
if (
accountNameFragment && // Is there anything to highlight?
!(
(!!evmAccount && (item as RuntimeAccount).address_eth === evmAccount) || // Did we find this searching for evm address
(!!evmAccount && (item as RuntimeAccount).address_eth?.toLowerCase() === evmAccount) || // Did we find this searching for evm address
// Did we find this searching for oasis address
(!!consensusAccount && (item as Account | RuntimeAccount).address === consensusAccount)
(!!consensusAccount && item.address.toLowerCase() === consensusAccount)
) // If we found this account based on address, then we don't want to highlight that.
) {
redirectTo += `?q=${accountNameFragment}`
Expand Down

0 comments on commit 09cac2d

Please sign in to comment.