Skip to content

Problems launching URLs with query string in Windows #167

@AliOsm

Description

@AliOsm

Hello @copiousfreetime , I'm reopening a 15 years old issue 😃

Looking here: #5, the issue mentions that doing the following:

require 'launchy'

Launchy.open('http://www.google.com?foo=bar&test')

Shows this error:

test is not recognized as an internal or external command, operable program or batch file.

And you already fixed the issue. Now I'm on Windows 11, running the same snippet above, produces the same issue again. This happens both on CMD and PowerShell. The actual link opens in the browser is just http://www.google.com?foo=bar, without any query string params after the ampersand &.

This is the debug output:

LAUNCHY_DEBUG: URI parsing pass 1 : http://www.google.com?foo=bar&test -> {scheme: "http", user: nil, password: nil, host: "www.google.com", port: nil, path: "", query: "foo=bar&test", fragment: nil}
LAUNCHY_DEBUG: Checking if class Launchy::Application::Browser is the one for handles?(http://www.google.com?foo=bar&test)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(mingw32)}
LAUNCHY_DEBUG: Launchy::Application::Browser : possibility from app_list : start \"launchy\" /b
LAUNCHY_DEBUG: Launchy::Application::Browser : Using browser value 'start \"launchy\" /b'
LAUNCHY_DEBUG: commandline_normalized => start "launchy" /b http://www.google.com?foo=bar&test
LAUNCHY_DEBUG: ChildProcess: argv => ["start", "\"launchy\"", "/b", "http://www.google.com?foo=bar&test"]

I tried to manually escape the ampersand using ^, \, or \\, but nothing worked.

Any thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions