Skip to content

Space character in Webview's Source causes net::ERR_FILE_NOT_FOUND error #23767

@CostasAthan

Description

@CostasAthan

Description

In a .NET 8 Maui project that targets Android API 34, I'm using a Webview with a Source defined by a variable: myWebView.Source = "https://example.com/?q=" + myVariable

If there is one or more leading or random spaces (%20) in myVariable, then I get a net::ERR_FILE_NOT_FOUND error:

Webpage not available

The webpage at file:///android_asset/https://example.com/?q=%20%20Test could not be loaded because:

net::ERR_FILE_NOT_FOUND

If there are only trailing spaces, there is no problem and the site loads fine. Of course the same is true if there are no spaces at all.

The URL opens without issues in Xamarin.Forms Webview and in every major web browser, so definitely that's a MAUI related bug.

Steps to Reproduce

A leading or random (not trailing) space (%20) in the query string of any URL passed to the Source property of a Webview will recreate the problem.

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

Android 34

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions