Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 9fdcf441 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #2863 from k9mail/GH-2861_fix_linkify_after_br_tag

Fix linkify when URL follows HTML tag
parents 23b903e7 2e20ddf6
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -13,7 +13,7 @@ import android.text.TextUtils;
public class UriLinkifier {
public class UriLinkifier {
    private static final Pattern URI_SCHEME;
    private static final Pattern URI_SCHEME;
    private static final Map<String, UriParser> SUPPORTED_URIS;
    private static final Map<String, UriParser> SUPPORTED_URIS;
    private static final String SCHEME_SEPARATORS = " (\\n";
    private static final String SCHEME_SEPARATORS = " (\\n>";
    private static final String ALLOWED_SEPARATORS_PATTERN = "(?:^|[" + SCHEME_SEPARATORS + "])";
    private static final String ALLOWED_SEPARATORS_PATTERN = "(?:^|[" + SCHEME_SEPARATORS + "])";


    static {
    static {
+9 −0
Original line number Original line Diff line number Diff line
@@ -136,4 +136,13 @@ public class UriLinkifierTest {
                        "<a href=\"http://uri2.example.org/path\">http://uri2.example.org/path</a> postfix",
                        "<a href=\"http://uri2.example.org/path\">http://uri2.example.org/path</a> postfix",
                outputBuffer.toString());
                outputBuffer.toString());
    }
    }

    @Test
    public void uriSurroundedByHtmlTags() {
        String text = "<br>http://uri.example.org<hr>";

        UriLinkifier.linkifyText(text, outputBuffer);

        assertEquals("<br><a href=\"http://uri.example.org\">http://uri.example.org</a><hr>", outputBuffer.toString());
    }
}
}