Skip to content

Commit

Permalink
fix(explorer): Unable to search Attestations by subject (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
alainncls authored Sep 2, 2024
1 parent 7d7a2c3 commit 0fe7e75
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions explorer/src/utils/searchUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ export const parseSearch = (search: string | null, chainPrefix: Hex): Partial<Re
const splitSearchBySpace = search.split(SPACE_STRING);

const startsWith0x = filterByRegex(splitSearchBySpace, regexEthAddress.by0x);
const potentialAttestationIds = filterByRegex(startsWith0x, regexEthAddress.byNumberOfChar[64]);
const rawNumbers = filterByRegex(splitSearchBySpace, isNumber);
const hexNumbers = rawNumbers.map((num) => buildAttestationId(Number(num), chainPrefix));
const attestationIds = [...startsWith0x, ...hexNumbers];
const startsWith0xWithoutNumber = startsWith0x.filter((str) => !attestationIds.includes(str));
const attestationIds = [...potentialAttestationIds, ...hexNumbers];

const defaultAddresses = filterByRegex(startsWith0xWithoutNumber, regexEthAddress.byNumberOfChar[42]);
const longAddresses = filterByRegex(startsWith0xWithoutNumber, regexEthAddress.byNumberOfChar[64]);
const defaultAddresses = filterByRegex(startsWith0x, regexEthAddress.byNumberOfChar[42]);
const longAddresses = filterByRegex(startsWith0x, regexEthAddress.byNumberOfChar[64]);

const urls = filterByRegex(splitSearchBySpace, urlRegex);
const allStrings = [...urls, ...defaultAddresses, ...longAddresses, ...attestationIds];
Expand Down

0 comments on commit 0fe7e75

Please sign in to comment.