From cfe332a8783319eda553eca2a485df01e6013faa Mon Sep 17 00:00:00 2001
From: Serhii <17529954+serhii-bor@users.noreply.github.com>
Date: Mon, 1 Jun 2026 20:13:07 +0300
Subject: [PATCH] fix for Mastadon lookup (#3272)
---
lib/entities/parse_address_from_domain.dart | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/entities/parse_address_from_domain.dart b/lib/entities/parse_address_from_domain.dart
index 0eea5a85d..7a6a47bc8 100644
--- a/lib/entities/parse_address_from_domain.dart
+++ b/lib/entities/parse_address_from_domain.dart
@@ -216,6 +216,14 @@ class AddressResolver {
return emailRegex.hasMatch(address);
}
+ String _stripHtmlTags(String value) {
+ return value
+ .replaceAll(RegExp(r'
', caseSensitive: false), '\n')
+ .replaceAll(RegExp(r'
', caseSensitive: false), '\n')
+ .replaceAll(RegExp(r'<[^>]*>'), '')
+ .trim();
+ }
+
Future resolve(BuildContext context, String text, CryptoCurrency currency) async {
final ticker = currency.title;
try {
@@ -348,7 +356,8 @@ class AddressResolver {
await MastodonAPI.lookupUserByUserName(userName: userName, apiHost: hostName);
if (mastodonUser != null) {
- String? addressFromBio = extractAddressByType(raw: mastodonUser.note, type: currency, requireSurroundingWhitespaces: true);
+ final mastodonNote = _stripHtmlTags(mastodonUser.note);
+ String? addressFromBio = extractAddressByType(raw: mastodonNote, type: currency, requireSurroundingWhitespaces: true);
if (addressFromBio != null && addressFromBio.isNotEmpty) {
return ParsedAddress.fetchMastodonAddress(
@@ -361,7 +370,7 @@ class AddressResolver {
await MastodonAPI.getPinnedPosts(userId: mastodonUser.id, apiHost: hostName);
if (pinnedPosts.isNotEmpty) {
- final userPinnedPostsText = pinnedPosts.map((item) => item.content).join('\n');
+ final userPinnedPostsText = pinnedPosts.map((item) => _stripHtmlTags(item.content)).join('\n');
String? addressFromPinnedPost =
extractAddressByType(raw: userPinnedPostsText, type: currency,
requireSurroundingWhitespaces: true);