8.6: Incoming URL should not be decoded

I thought the use of Uri.decodeFull at the start of AppLink.fromLocation(String?) looked a bit suspicious, so I did some experimentation on all platforms. The call is indeed unnecessary, and changes the meaning of the URL if some special characters are present.

If we were to pass in the following URL (just the path on the web):

fooderlich://raywenderlich.com/home?tab=0&candy=M%26M

The expected query parameters after parsing the URI are:

  • tab with a value of 0
  • candy with a value of M&M

Putting a breakpoint in AppLink.fromLocation, the URL arrives already decoded on iOS and the web. On Android, the %26 has even already been converted back to an &, which must surely be some other bug, but that might have to do with how Iā€™m passing it to adb shell to begin with, so Iā€™m ignoring that one for now.

Long story short, with the pass through Uri.decodeFull(), there are now three query parameters:

  • tab with a value of 0
  • candy with a value of M
  • M with no value

Without the call to Uri.decodeFull(), the result of Uri.parse is as expected.