Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.hotwire.core.turbo.config

import com.google.gson.annotations.SerializedName
import java.net.MalformedURLException
import java.net.URL

@ConsistentCopyVisibility
Expand Down Expand Up @@ -36,7 +37,11 @@ data class PathConfigurationData internal constructor(
}

private fun path(location: String): String {
val url = URL(location)
val url = try {
URL(location)
} catch (e: MalformedURLException) {
return ""
}

return if (url.query == null) {
url.path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ class PathConfigurationTest : BaseRepositoryTest() {
assertThat(pathConfiguration.properties("$url/new").pullToRefreshEnabled).isFalse
}

@Test
fun unknownSchemeLocationDoesNotThrow() {
assertThat(pathConfiguration.properties("mailto:test@example.com")).isNotNull
assertThat(pathConfiguration.properties("tel:+15551234567")).isNotNull
assertThat(pathConfiguration.properties("sms:+15551234567")).isNotNull
assertThat(pathConfiguration.properties("custom-app://feature")).isNotNull
}

@Test
fun customProperties() {
assertThat((pathConfiguration.properties("$url/custom/tabs").getTabs()?.size)).isEqualTo(1)
Expand Down
Loading