Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions dcache/src/main/java/dora/http/log/UrlEncoderUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class UrlEncoderUtils private constructor() {
if (isValidHexChar(c1) && isValidHexChar(c2)) {
encode = true
break
} else {
break
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions dcache/src/test/java/dora/http/log/UrlEncoderUtilsTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package dora.http.log

import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test

class UrlEncoderUtilsTest {

@Test
fun hasUrlEncoded_detectsValidSequences() {
assertTrue(UrlEncoderUtils.hasUrlEncoded("abc%20def"))
}

@Test
fun hasUrlEncoded_ignoresInvalidSequences() {
assertTrue(UrlEncoderUtils.hasUrlEncoded("abc%2G%20def"))
assertFalse(UrlEncoderUtils.hasUrlEncoded("abc%2Gdef"))
}
}