pikaju / flutter-maps-launcher

Simple Flutter package to open the maps application (or browser) on all platforms.
https://pub.dev/packages/maps_launcher
MIT License
61 stars 47 forks source link

Fixed bad URL escaping of queries and labels #3

Closed lenlo closed 4 years ago

lenlo commented 4 years ago

If you happened to provide a query or label that included certain syntactically meaningful URL characters like '#' or '&', the resulting URL would be broken as those characters would appear in the raw and not be escaped.

This is because Uri.encodeFull is a terrible function that should be abolished. It lures people into thinking that you can put arbitrary strings into URL segments & parameters and have Uri.encodeFull automagically escape them for you while keeping the rest of the URL syntax intact. Alas, this is not the case as it won't -- and can't -- escape characters that are syntactically meaningful in URLs like '/', '#', '?', etc. The result is that some characters get escaped but not others and any query parameter that happens to include them will break the URL.

A more effective solution is to create a proper Uri from the components and then stringify it using toString().

pikaju commented 4 years ago

Wow I did not see this. Sorry for being so late, I'll merge it in, thank you!