Merge pull request #3745 from mempool/mononaut/address-false-positive

Fix txids interpreted as addresses in search bar
This commit is contained in:
softsimon 2023-05-11 17:34:19 -05:00 committed by GitHub
commit fe51f6a504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,7 +153,7 @@ export class SearchFormComponent implements OnInit {
const matchesBlockHeight = this.regexBlockheight.test(searchText); const matchesBlockHeight = this.regexBlockheight.test(searchText);
const matchesTxId = this.regexTransaction.test(searchText) && !this.regexBlockhash.test(searchText); const matchesTxId = this.regexTransaction.test(searchText) && !this.regexBlockhash.test(searchText);
const matchesBlockHash = this.regexBlockhash.test(searchText); const matchesBlockHash = this.regexBlockhash.test(searchText);
const matchesAddress = this.regexAddress.test(searchText); const matchesAddress = !matchesTxId && this.regexAddress.test(searchText);
if (matchesAddress && this.network === 'bisq') { if (matchesAddress && this.network === 'bisq') {
searchText = 'B' + searchText; searchText = 'B' + searchText;
@ -198,7 +198,7 @@ export class SearchFormComponent implements OnInit {
const searchText = result || this.searchForm.value.searchText.trim(); const searchText = result || this.searchForm.value.searchText.trim();
if (searchText) { if (searchText) {
this.isSearching = true; this.isSearching = true;
if (this.regexAddress.test(searchText)) { if (!this.regexTransaction.test(searchText) && this.regexAddress.test(searchText)) {
this.navigate('/address/', searchText); this.navigate('/address/', searchText);
} else if (this.regexBlockhash.test(searchText) || this.regexBlockheight.test(searchText)) { } else if (this.regexBlockhash.test(searchText) || this.regexBlockheight.test(searchText)) {
this.navigate('/block/', searchText); this.navigate('/block/', searchText);