From 819b6861c06b0f111ec4045f29bf7bb29182578a Mon Sep 17 00:00:00 2001 From: Leon Date: Fri, 24 Jul 2026 09:17:04 +0200 Subject: [PATCH 1/2] Fix crash on non-HTTP scheme links --- .../dev/hotwire/core/turbo/config/PathConfigurationData.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/dev/hotwire/core/turbo/config/PathConfigurationData.kt b/core/src/main/kotlin/dev/hotwire/core/turbo/config/PathConfigurationData.kt index f54b551..73c84a9 100644 --- a/core/src/main/kotlin/dev/hotwire/core/turbo/config/PathConfigurationData.kt +++ b/core/src/main/kotlin/dev/hotwire/core/turbo/config/PathConfigurationData.kt @@ -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 @@ -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 From 011afcb6e83a91c8426d4e004624b728d1f8aaf4 Mon Sep 17 00:00:00 2001 From: Milan Barta Date: Mon, 27 Jul 2026 11:29:37 +0200 Subject: [PATCH 2/2] Add test coverage for non-HTTP scheme locations The tel:, sms: and custom scheme cases also guard the fix when running on the JVM: the desktop JDK bundles a mailto protocol handler, so the mailto case alone would pass even without the fix. Android's libcore has no mailto handler and throws for all of these schemes. Co-Authored-By: Claude Fable 5 --- .../hotwire/core/turbo/config/PathConfigurationTest.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/test/kotlin/dev/hotwire/core/turbo/config/PathConfigurationTest.kt b/core/src/test/kotlin/dev/hotwire/core/turbo/config/PathConfigurationTest.kt index 56549ad..9bebba6 100644 --- a/core/src/test/kotlin/dev/hotwire/core/turbo/config/PathConfigurationTest.kt +++ b/core/src/test/kotlin/dev/hotwire/core/turbo/config/PathConfigurationTest.kt @@ -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)