From 71d186ad593d0f96f9810923231ffba5b8b583e4 Mon Sep 17 00:00:00 2001 From: jubb Date: Tue, 3 Aug 2021 14:21:05 +1000 Subject: [PATCH] fix: ASCIIfy the URL open dialog's content. fixes #681 --- .../conversation/v2/messages/VisibleMessageContentView.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageContentView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageContentView.kt index ec55af5427..802cc14f69 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageContentView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageContentView.kt @@ -41,6 +41,7 @@ import org.thoughtcrime.securesms.mms.GlideRequests import org.thoughtcrime.securesms.util.SearchUtil import org.thoughtcrime.securesms.util.SearchUtil.StyleFactory import org.thoughtcrime.securesms.util.UiModeUtilities +import java.net.IDN import java.util.* import kotlin.math.roundToInt @@ -212,7 +213,8 @@ class VisibleMessageContentView : LinearLayout { // replace URLSpans with ModalURLSpans body.getSpans(0, body.length).toList().forEach { urlSpan -> - val replacementSpan = ModalURLSpan(urlSpan.url) { url -> + val updatedUrl = urlSpan.url.let(IDN::toASCII) + val replacementSpan = ModalURLSpan(updatedUrl) { url -> val activity = context as AppCompatActivity OpenURLDialog(url).show(activity.supportFragmentManager, "Open URL Dialog") }