File tree Expand file tree Collapse file tree
main/kotlin/dev/hotwire/core/turbo/config
test/kotlin/dev/hotwire/core/turbo/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package dev.hotwire.core.turbo.config
22
33import com.google.gson.annotations.SerializedName
4+ import java.net.MalformedURLException
45import java.net.URL
56
67@ConsistentCopyVisibility
@@ -36,7 +37,11 @@ data class PathConfigurationData internal constructor(
3637 }
3738
3839 private fun path (location : String ): String {
39- val url = URL (location)
40+ val url = try {
41+ URL (location)
42+ } catch (e: MalformedURLException ) {
43+ return " "
44+ }
4045
4146 return if (url.query == null ) {
4247 url.path
Original file line number Diff line number Diff line change @@ -201,6 +201,14 @@ class PathConfigurationTest : BaseRepositoryTest() {
201201 assertThat(pathConfiguration.properties(" $url /new" ).pullToRefreshEnabled).isFalse
202202 }
203203
204+ @Test
205+ fun unknownSchemeLocationDoesNotThrow () {
206+ assertThat(pathConfiguration.properties(" mailto:test@example.com" )).isNotNull
207+ assertThat(pathConfiguration.properties(" tel:+15551234567" )).isNotNull
208+ assertThat(pathConfiguration.properties(" sms:+15551234567" )).isNotNull
209+ assertThat(pathConfiguration.properties(" custom-app://feature" )).isNotNull
210+ }
211+
204212 @Test
205213 fun customProperties () {
206214 assertThat((pathConfiguration.properties(" $url /custom/tabs" ).getTabs()?.size)).isEqualTo(1 )
You can’t perform that action at this time.
0 commit comments