-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[url_launcher] Add a workaround for Uri encoding #3817
[url_launcher] Add a workaround for Uri encoding #3817
Conversation
`Uri`'s constructor doesn't handle query parameters correctly for non-http(s) schemes, so the `mailto` example in the README is misleading. This adds a new utility method to do query string construction correctly, and updates the README to show using it and warning about the need to use it in general. If/when `Uri` is fixed to handle generic URI query parameters correctly, this utility method can be deprecated. Fixes flutter/flutter#75552 Fixes flutter/flutter#73717
Hey @stuartmorgan , I'm not sure if you are still working on that fix here, but I'm running into an issue that looks like your PR could possibly fix my issue with the encoding of linebreaks: https://stackoverflow.com/questions/67859136/flutter-url-launcher-line-break-doesnt-work-in-ios-mail-program Maybe you find some time to finalize your PR, I think it could be very helpful! Best regards |
A decision on what to do here is pending a decision in dart-lang/sdk#43838 I may just do a README update in the short term. |
I see, thx for coming back to me so quickly! Will use the suggested workaround from there and just replace the |
Based on discussion with Hixie we're not going to put the workaround in the plugin itself, where we'll need to maintain it (or break people) even after the Dart bug is fixed, so I've updated this to just show the workaround in the README. This will avoid the issue of people following the README and getting the wrong behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a simpler version where people can call Uri.toString().replace("+", "%20")
, but this one is more "standard" (especially in JS you'd end up some code like this if you were concatenating your own URLs).
Anyway, ship it! 🚀
Only in the same sense that there's a simpler version where you write
If by "standard" you mean "correct", then yes 🙂 The URI spec allows for Which means that your |
Landing this simple PR on red to force post-submit CI to run, since we believe the last round of post-submit failures was due to an infra migration that was happening that impacted Cirrus jobs. |
`Uri`'s constructor doesn't handle query parameters correctly for non-http(s) schemes, so the `mailto` example in the README is misleading. This updates the README to show using a simple method to work around that bug, and a warning about the need to use it. Fixes flutter/flutter#75552 Fixes flutter/flutter#73717
Uri
's constructor doesn't handle query parameters correctly fornon-http(s) schemes, so the
mailto
example in the README ismisleading. This updates the README to show using a simple method
to work around that bug, and a warning about the need to use it.
Fixes flutter/flutter#75552
Fixes flutter/flutter#73717
Pre-launch Checklist
dart format
. See plugin_tool format)[shared_preferences]
///
).