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

Commit 2e20ddf6 authored by cketti's avatar cketti
Browse files

Fix linkify when URL follows HTML tag

parent 27bc562e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ import android.text.TextUtils;
public class UriLinkifier {
    private static final Pattern URI_SCHEME;
    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 + "])";

    static {
+9 −0
Original line number 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",
                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());
    }
}