Skip to content

Commit

Permalink
fix: check search strings for shelley-era addresses, to avoid clash w…
Browse files Browse the repository at this point in the history
…ith testnet stake addresses and hashes
  • Loading branch information
rhyslbw committed Nov 12, 2020
1 parent 048e18b commit 58c004a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/features/search/ui/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export const SearchBar = (props: ISearchBarProps) => {
const networkInfo = useNetworkInfoFeature().store;
const introspectQuery = (query: string, type?: string) => {
const typeOfSearch = type ? type : searchType;
if (query?.length === 64) {
if (query.substring(0, 4) === 'addr' || query.substring(0, 5) === 'stake') {
search.actions.addressSearchRequested.trigger({
address: query,
});
} else if (query?.length === 64) {
search.actions.idSearchRequested.trigger({ id: query });
} else if (/^\d+$/.test(query)) {
const searchNumber = parseInt(query, 10);
Expand All @@ -42,6 +46,7 @@ export const SearchBar = (props: ISearchBarProps) => {
}
}
} else {
// Byron-era addresses have no prefix or standard length
search.actions.addressSearchRequested.trigger({
address: query,
});
Expand Down

0 comments on commit 58c004a

Please sign in to comment.