Adds treatment for the transition between ASCII and non-ASCII in the middle of urls

This commit is contained in:
Vitor Pamplona
2026-03-07 15:19:24 -05:00
parent 5e1a193f78
commit 030921c963
7 changed files with 78 additions and 36 deletions
@@ -37,9 +37,8 @@ class UrlMarkerTest {
indices: IntArray,
) {
val urlMarker = UrlMarker()
urlMarker.originalUrl = testString
urlMarker.setIndices(indices)
val url = urlMarker.createUrl()
val url = urlMarker.createUrl(testString)
assertEquals(url.host, host, "host, " + testString)
assertEquals(url.path, path, "path, " + testString)
assertEquals(url.scheme, scheme, "scheme, " + testString)
@@ -735,6 +735,13 @@ class UriDetectionTest {
runTest("I saw this on http://[::1]:3000 I think it is really cool", "http://[::1]:3000")
}
@Test
fun testNoSchemaUrlMultibyteAscii() {
runTest("ほtest.com", "test.com")
runTest("test.comほ", "test.com")
runTest("ほtest.comほ", "test.com")
}
private fun runTest(
text: String,
vararg expected: String?,