Open the sign-in URL on Windows
Login Flow v2 cannot complete without a browser, and the launcher had a branch for xdg-open, one for Android's Intent, and an honest Unsupported error for everything else — which on Windows stranded the flow on "approve the sign-in in your browser". rundll32 url.dll,FileProtocolHandler is ShellExecute on the URL and needs no crate; chosen over cmd /C start, whose quoting of & in a query string is a known trap. Not verified: Wine has no browser to open.
This commit is contained in:
@@ -816,9 +816,26 @@ fn open_in_browser(url: &str) -> std::io::Result<()> {
|
||||
{
|
||||
android_open_url(url).map_err(|e| std::io::Error::other(e))
|
||||
}
|
||||
// TRACES: FR-PLAT-WIN-2
|
||||
// `ShellExecute` by way of the shell's URL handler, which is what a
|
||||
// double-click on a link does, and needs no crate: `rundll32
|
||||
// url.dll,FileProtocolHandler` has opened the default browser since
|
||||
// Windows 98 and is still what the platform documents for the purpose.
|
||||
// Not `cmd /C start`, whose quoting of `&` in a query string is a
|
||||
// well-known trap.
|
||||
#[cfg(windows)]
|
||||
{
|
||||
std::process::Command::new("rundll32")
|
||||
.args(["url.dll,FileProtocolHandler", url])
|
||||
.stdout(std::process::Stdio::null())
|
||||
.stderr(std::process::Stdio::null())
|
||||
.spawn()
|
||||
.map(|_| ())
|
||||
}
|
||||
#[cfg(not(any(
|
||||
all(unix, not(target_os = "android"), not(target_os = "macos")),
|
||||
target_os = "android"
|
||||
target_os = "android",
|
||||
windows
|
||||
)))]
|
||||
{
|
||||
let _ = url;
|
||||
|
||||
Reference in New Issue
Block a user