diff --git a/app/src/main/java/com/geeksville/mesh/model/Channel.kt b/app/src/main/java/com/geeksville/mesh/model/Channel.kt index 7cd889554..e698dbccb 100644 --- a/app/src/main/java/com/geeksville/mesh/model/Channel.kt +++ b/app/src/main/java/com/geeksville/mesh/model/Channel.kt @@ -31,17 +31,17 @@ data class Channel( MeshProtos.ChannelSettings.newBuilder().setName(defaultChannelName) .setModemConfig(MeshProtos.ChannelSettings.ModemConfig.Bw125Cr45Sf128).build() ) - - private const val prefixRoot = "https://www.meshtastic.org/c/" - const val prefix = "$prefixRoot#" + + const val prefix = "https://www.meshtastic.org/c/#" private const val base64Flags = Base64.URL_SAFE + Base64.NO_WRAP private fun urlToSettings(url: Uri): MeshProtos.ChannelSettings { val urlStr = url.toString() - // Let the path optionally include the # character (or not) so we can work with old URLs generated by old versions of the app - val pathRegex = Regex("$prefixRoot#?(.*)") + // We no longer support the super old (about 0.8ish? verison of the URLs that don't use the # separator - I doubt + // anyone is still using that old format + val pathRegex = Regex("$prefix(.*)") val (base64) = pathRegex.find(urlStr)?.destructured ?: throw MalformedURLException("Not a meshtastic URL: ${urlStr.take(40)}") val bytes = Base64.decode(base64, base64Flags)