Bug: MacOS WebBrowserComponent goToUrl Drops Query Parameters For File URLs

I just upgraded from JUCE 6.0.7 to 6.0.8 and noticed a bug – my app relies on loading HTML files with the WebBrowserComponent::goToUrl and passing in query parameters to configure behavior in the page. My GUI creates a WebBrowserComponent on construction and passes in something like this:

mWebView->goToUrl("file:///Users/me/index.html?param1=some_cookie");

In 6.0.7, this worked fine. But the 6.0.8 MacOS WebBrowserComponent added this clause, which drops ?param1=some_cookie on the floor:

        if (trimmed.startsWithIgnoreCase ("file:"))
        {
            auto file = URL (url).getLocalFile();

            if (NSURL* nsUrl = [NSURL fileURLWithPath: juceStringToNS (file.getFullPathName())])
                [webView loadFileURL: nsUrl allowingReadAccessToURL: nsUrl];
        }

To check, if you implement a pageFinishedLoading callback, the url would be file:///Users/me/index.html without the params, which in the case of the HTML file I am loading causes configuration issues.

I’ve edited my local copy of JUCE to remove that clause so things work for me for now locally at least, though I’m not very familiar with WkWebView so I’m sure it was there for a good reason; figured I should mention this use case in case there is a desire to address it upstream.

Thanks for reporting. This has been fixed on the develop branch here:

1 Like