RoverPlatform / rover-campaigns-android

Apache License 2.0
1 stars 0 forks source link

Query Parameter Parsing Issue #91

Closed samwoodall closed 1 year ago

samwoodall commented 4 years ago

This logic in StringExtensions.kt can cause issues with certain deep links/app links when a query parameter value contains a character that is decoded as &. This causes an IndexOutOfBoundException when keyAndValue[1] is called as the split function called during keyAndValue assignment will not have found the delimiter =

fun String.parseAsQueryParameters(): Map<String, String> {
    return split("&").map {
        val keyAndValue = it.split("=")
        Pair(keyAndValue.first(), keyAndValue[1])
    }.associate { it }
}