Fix issue #403 - Freezes

This commit is contained in:
Thomas 2022-11-15 18:02:49 +01:00
parent fe10411618
commit 393d2990f0
2 changed files with 7 additions and 1 deletions

View File

@ -340,6 +340,11 @@ public class Helper {
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
public static final Pattern urlPatternSimple = Pattern.compile(
"https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)",
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
public static final Pattern aLink = Pattern.compile("<a((?!href).)*href=\"([^\"]*)\"[^>]*(((?!</a).)*)</a>");
public static final Pattern imgPattern = Pattern.compile("<img [^>]*src=\"([^\"]+)\"[^>]*>");

View File

@ -18,6 +18,7 @@ package app.fedilab.android.helper;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.helper.Helper.USER_AGENT;
import static app.fedilab.android.helper.Helper.urlPattern;
import static app.fedilab.android.helper.Helper.urlPatternSimple;
import static app.fedilab.android.helper.ThemeHelper.linkColor;
import android.content.ClipData;
@ -190,7 +191,7 @@ public class SpannableHelper {
private static void linkify(Context context, SpannableStringBuilder content, HashMap<String, String> urlDetails) {
//--- URLs ----
Matcher matcherLink = urlPattern.matcher(content);
Matcher matcherLink = urlPatternSimple.matcher(content);
int offSetTruncate = 0;