mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 06:06:13 +00:00
winebrowser: Prefix an invalid URL with 'http://' before opening with a browser.
Fixes usage like 'winebrowser winehq.org' when xdg-open or macOS 'open' is used. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50094 Signed-off-by: Brendan Shanks <bshanks@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
786451c1b6
commit
a688cb6971
1 changed files with 25 additions and 2 deletions
|
@ -184,6 +184,29 @@ static int open_mailto_url( const WCHAR *url )
|
|||
return launch_app( mailers, url );
|
||||
}
|
||||
|
||||
static int open_invalid_url( const WCHAR *url )
|
||||
{
|
||||
static const WCHAR httpW[] =
|
||||
{'h','t','t','p',':','/','/',0};
|
||||
|
||||
WCHAR *url_prefixed;
|
||||
int ret;
|
||||
|
||||
url_prefixed = HeapAlloc( GetProcessHeap(), 0, (ARRAY_SIZE(httpW) + strlenW( url )) * sizeof(WCHAR) );
|
||||
if (!url_prefixed)
|
||||
{
|
||||
WINE_ERR("Out of memory\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
strcpyW( url_prefixed, httpW );
|
||||
strcatW( url_prefixed, url );
|
||||
|
||||
ret = open_http_url( url_prefixed );
|
||||
HeapFree( GetProcessHeap(), 0, url_prefixed );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* DDE helper functions.
|
||||
*/
|
||||
|
@ -448,8 +471,8 @@ int __cdecl wmain(int argc, WCHAR *argv[])
|
|||
|
||||
hres = CreateUri(url, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
|
||||
if(FAILED(hres)) {
|
||||
WINE_ERR("Failed to parse URL\n");
|
||||
ret = open_http_url(url);
|
||||
WINE_ERR("Failed to parse URL %s, treating as HTTP\n", wine_dbgstr_w(url));
|
||||
ret = open_invalid_url(url);
|
||||
HeapFree(GetProcessHeap(), 0, ddeString);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue