show url prefix for debugging

This commit is contained in:
geeksville 2020-09-08 12:05:19 -07:00
parent 9cea9ce457
commit 2fbd0a7a5e

View file

@ -4,7 +4,6 @@ import android.graphics.Bitmap
import android.net.Uri
import android.util.Base64
import com.geeksville.mesh.MeshProtos
import com.geeksville.util.anonymize
import com.google.zxing.BarcodeFormat
import com.google.zxing.MultiFormatWriter
import com.journeyapps.barcodescanner.BarcodeEncoder
@ -44,7 +43,7 @@ data class Channel(
// 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#?(.*)")
val (base64) = pathRegex.find(urlStr)?.destructured
?: throw MalformedURLException("Not a meshtastic URL: ${urlStr.anonymize(40)}")
?: throw MalformedURLException("Not a meshtastic URL: ${urlStr.take(40)}")
val bytes = Base64.decode(base64, base64Flags)
return MeshProtos.ChannelSettings.parseFrom(bytes)