flutter / devtools

Performance tools for Flutter
https://flutter.dev/docs/development/tools/devtools/
BSD 3-Clause "New" or "Revised" License
1.59k stars 326 forks source link

Stop double encoding the vm service URI #2968

Open kenzieschmoll opened 3 years ago

kenzieschmoll commented 3 years ago

The vm service URI (value of the uri query param in the DevTools url) is currently double encoded.

this could be happening on our end, or this could be happening from the IDEs (FYI @helin24, @DanTup) - I have yet to confirm either way.

DanTup commented 3 years ago

Perhaps related to this? (specifically the inner comment)

https://github.com/flutter/devtools/blob/28969fddbbd97d7e10f04626a22fbc0cb2829932/packages/devtools_app/web/index.html#L43-L53

It's been a while, but IIRC when the URL contained something like xxxhttp://foo/bar Flutter was pushing routes for http:, xxxhttp:/, xxxhttp://foo, xxxhttp://foo.bar. I don't know if that's still an issue, but if not the fix may be just removing the params.forEach line.

DanTup commented 3 years ago

I launched DevTools from VS Code and ended up at this URL:

http://127.0.0.1:9100/#/?hide=debugger&ide=VSCode&theme=dark&uri=http%3A%2F%2F127.0.0.1%3A49856%2FRIW4pcT2XMI%3D%2F

If I understand correctly, the uri variable here is only encoded once (this is after it's been through the redirect in the JS above), so I'm not sure if I'm hitting the issue (or whether it's being compensated for somewhere).

helin24 commented 3 years ago

We encode the URI once in the plugin. From my current test it looks like the URI is not encoded when we first receive it.

Starting URL: http://127.0.0.1:55403/6hvCR98N-14= Ending URL (after plugin encoding): http%3A%2F%2F127.0.0.1%3A55403%2F6hvCR98N-14%3D

Let me know if we should change this.