Skip to content

DevTools url has fragment and query parameters in the wrong order #2475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kenzieschmoll opened this issue Oct 30, 2020 · 7 comments · Fixed by #3585
Closed

DevTools url has fragment and query parameters in the wrong order #2475

kenzieschmoll opened this issue Oct 30, 2020 · 7 comments · Fixed by #3585
Milestone

Comments

@kenzieschmoll
Copy link
Member

Current: http://127.0.0.1:9100/#/timeline?ide=IntelliJ-IDEA&uri=http%253A%252F%252F127.0.0.1%253A59289%252FolleV5zVaVs%253D

Expected: http://127.0.0.1:9100/?ide=IntelliJ-IDEA&uri=http%253A%252F%252F127.0.0.1%253A59289%252FolleV5zVaVs%253D#/timeline

In the current form, Uri.parse gets the incorrect values for fragment and queryParameters

@kenzieschmoll
Copy link
Member Author

FYI @DanTup

@kenzieschmoll kenzieschmoll added this to the M23 milestone Nov 3, 2020
@DanTup
Copy link
Contributor

DanTup commented Nov 4, 2020

Although it's a bit unintuitive, this is expected. It's not how a URL normally would be formed but in Flutter we only get the fragment part, and we had a convention of putting a query string in it for pass our data around.

Since the routing changes, we handle the URI parsing in DevToolsRouteInformationParser.parseRouteInformation where routeInformation.location will be just the fragment, eg.:

When at page: http://localhost:50593/#/?hide=debugger&ide=VSCode&theme=dark&uri=foo
routeInformation.fragment is: /?hide=debugger&ide=VSCode&theme=dark&uri=foo

Which we then parse into a URI to get path (/) and queryParameters.

Have you found code that is parsing the URI directly? If so, we should update it to use the params from the routing (since this should also work better for non-web too).

(As an aside, while looking at this I noticed hide=debugger isn't working, but I believe that's unrelated and have raised #2486).

@kenzieschmoll
Copy link
Member Author

Now there is another '?' character in the url that is causing url parsing issues when trying to show the DevTools survey
e.g. 'http://127.0.0.1:9103/?#/?'

related: flutter/website#6696

@DanTup
Copy link
Contributor

DanTup commented Jan 19, 2022

@kenzieschmoll are you looking at this or did you want me to? If me, how do you end up with the bad URL? Is the goal to fix that, or just handle it better when it happens?

@kenzieschmoll
Copy link
Member Author

@DanTup if you have time to take a peek, feel free! The bad url happens by default right now. I just opened DevTools to the connect screen and got the url with two '?' chars. The logic in #3574 shows an example of where it would be nice if we could just parse the Uri with Uri.parse and be able to grab the fragment directly instead of doing what we currently have to do which is manipulate the string with indexOf calls to find what we are looking for. This works, but is not robust.

@DanTup
Copy link
Contributor

DanTup commented Jan 20, 2022

How are you starting the app? If I run from VS Code by pressing F5 in the devtools_app folder, I only see one ? in the URL:

Screenshot 2022-01-20 at 10 16 14

I'm using Flutter 2.9.0-1.0.pre.384

@kenzieschmoll
Copy link
Member Author

I was using a release build:
./tool/build_release.sh
dart packages/devtools/bin/devtools.dart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants