Skip to content
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

[url_launcher] Decode URL before passing it to ShellExecuteW. #7774

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ftsui
Copy link

@ftsui ftsui commented Oct 3, 2024

  • ShellExecuteW expects a path, not a URL. If the path contains non-ascii characters, it needs to be decoded before passing to ShellExecuteW.
  • ShellExecuteW seems to be happy with the file:// prefix in the URL

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@ftsui ftsui requested a review from cbracken as a code owner October 3, 2024 00:30
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@ftsui ftsui changed the title Decode URL before passing it to ShellExecuteW. [url_launcher] Decode URL before passing it to ShellExecuteW. Oct 3, 2024
@ftsui ftsui force-pushed the urllauncher branch 6 times, most recently from 70be8ea to cf02161 Compare October 3, 2024 18:58
- ShellExecuteW expects a path, not a URL.  If the path contains non-ascii
  characters, it needs to be decoded before passing to ShellExecuteW.
- ShellExecuteW seems to be happy with the file:// prefix in the URL
@stuartmorgan
Copy link
Contributor

Thanks for the contribution! Since the checklist isn't complete, I'm assuming this is a work in progress, and marking as a Draft accordingly. Once you've completed all of the steps, please mark it as ready for review.

It also appears that this PR assumes that url_launcher is only used for file: URLs. It's intended for use with any URL, and is very frequently used with schemes like https and mailto; a change that breaks those use cases would not be accepted.

@stuartmorgan stuartmorgan marked this pull request as draft October 5, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants