From 34a6f37041b25dfee93d0691c9ebcc6ff26fca9d Mon Sep 17 00:00:00 2001 From: 5t34k <261338165+5t34k@users.noreply.github.com> Date: Fri, 26 Jun 2026 06:04:23 +1000 Subject: [PATCH] Fix hashtags incorrectly displayed inside URLs (#692) When a URL contains a # fragment (e.g. https://example.com/page#section), the hashtag regex matches the fragment as a hashtag. The overlap removal logic already removes hashtags overlapping geohashes, and geohashes overlapping URLs, but did not remove hashtags overlapping URLs. Add the missing overlapsUrl check to the hashtag condition. --- app/src/main/java/com/bitchat/android/ui/ChatUIUtils.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/bitchat/android/ui/ChatUIUtils.kt b/app/src/main/java/com/bitchat/android/ui/ChatUIUtils.kt index e3097eed..6dd02584 100644 --- a/app/src/main/java/com/bitchat/android/ui/ChatUIUtils.kt +++ b/app/src/main/java/com/bitchat/android/ui/ChatUIUtils.kt @@ -398,10 +398,10 @@ private fun appendIOSFormattedContent( val iterator = allMatches.listIterator() while (iterator.hasNext()) { val (range, type) = iterator.next() - // Remove generic hashtags that overlap with geohashes, and geohashes that overlap with URLs + // Remove generic hashtags that overlap with geohashes or URLs, and geohashes that overlap with URLs val overlapsGeo = geoRanges.any { rangesOverlap(range, it) } val overlapsUrl = urlRanges.any { rangesOverlap(range, it) } - if ((type == "hashtag" && overlapsGeo) || (type == "geohash" && overlapsUrl)) iterator.remove() + if ((type == "hashtag" && (overlapsGeo || overlapsUrl)) || (type == "geohash" && overlapsUrl)) iterator.remove() } }