https://kotlinlang.org logo
#compose
Title
# compose
a

allan.conda

01/05/2022, 3:44 AM
Is there a length limit for navigation routes? Saw an old thread but seems to be about a different issue. We’re sending a form input as query input which can take up to 1000 characters. The destination cannot be found if the argument is too long it seems.
i

Ian Lake

01/05/2022, 4:06 AM
There is no limit
If your 'query input' contains special characters, you'd need to
Uri.encode
it
2
a

allan.conda

01/05/2022, 7:21 AM
Yeah, we do encode it. Let me double check the value. Edit: I’m seeing only percents and numbers. Trying to binary search if there is a specific set of characters which breaks the navigation destination matching
Soo... Turns out it's the same double decoding root cause that I raised for a different issue.
r

Rafael Costa

01/05/2022, 11:55 AM
let me guess, some of your arguments are not mandatory arguments right Allan?
I actually have opened a change in the Androix repo (I was not sure if how exactly was the best way to open an issue with a suggestion fix, so I did that 😅 ) where I explain that non mandatory arguments are being decoded twice. Your fix for now is probably to also encode twice all non mandatory arguments. The mandatory arguments, you must only encode once
and sorry if there is a more correct way to do that 😅
a

allan.conda

01/05/2022, 5:09 PM
I had raised it last month but for a different issue. https://issuetracker.google.com/issues/210711399
Yeah optional args, the bug in the code is pretty clear. Actually I don't encode twice because it will break once they fix it. I manually do the decoding instead from the route which is also included as an argument.
r

Rafael Costa

01/05/2022, 5:15 PM
I see. Yeah you could also just remove the second encode call just before updating the nav lib to the one with the fix. That's what Im doing in my navigation library. (If you're curious: https://github.com/raamcosta/compose-destinations)
a

allan.conda

01/05/2022, 5:26 PM
Wow. Cool lib.
👍 1
r

Rafael Costa

01/05/2022, 5:27 PM
Thanks 😊 If you can, give it a try and give me feedback!
👌 1
32 Views