Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix for WebView Fails to Load URLs with Certain Encoded Characters #27003

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

praveenkumarkarunanithi
Copy link
Contributor

@praveenkumarkarunanithi praveenkumarkarunanithi commented Jan 8, 2025

Root Cause

The root cause of the issue is the use of Uri.IsWellFormedUriString for validating URLs in the WebView control. This method applies overly strict checks, including the IsWellFormedOriginalString test, which can incorrectly reject valid URLs, especially those containing encoded characters or international characters. This leads to improper handling of certain valid URLs, causing them to be treated as relative paths instead of absolute URLs.

Description of Change

In the WebView control, the URL validation logic in MauiWebView.LoadUrl has been updated to replace Uri.IsWellFormedUriString with Uri.TryCreate. This change ensures that a wider range of valid URLs, including those with encoded and international characters, are correctly handled as absolute URLs.

Issues Fixed

Fixes #26843
Fixes #23767
Fixes #23690
Closes #24002

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Screenshots

Before Issue Fix After Issue Fix
withoutfix withfix

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jan 8, 2025
@praveenkumarkarunanithi
Copy link
Contributor Author

@dotnet-policy-service agree company="Syncfusion, Inc."

@vishnumenon2684 vishnumenon2684 added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 8, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

This comment was marked as outdated.

@jsuarezruiz
Copy link
Contributor

jsuarezruiz commented Jan 17, 2025

/azp run

This comment was marked as outdated.

@jfversluis jfversluis self-assigned this Jan 20, 2025
@praveenkumarkarunanithi praveenkumarkarunanithi marked this pull request as ready for review January 22, 2025 08:23
@praveenkumarkarunanithi praveenkumarkarunanithi requested a review from a team as a code owner January 22, 2025 08:23
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build error

/Users/builder/azdo/_work/3/s/src/Core/src/Platform/WebViewHelper.cs(9,32): error CS1503: Argument 1: cannot convert from 'char' to 'string' [/Users/builder/azdo/_work/3/s/src/Core/src/Core.csproj::TargetFramework=netstandard2.0]

@MartyIX
Copy link
Contributor

MartyIX commented Jan 25, 2025

Build error

/Users/builder/azdo/_work/3/s/src/Core/src/Platform/WebViewHelper.cs(9,32): error CS1503: Argument 1: cannot convert from 'char' to 'string' [/Users/builder/azdo/_work/3/s/src/Core/src/Core.csproj::TargetFramework=netstandard2.0]

IMHO we hit #27003 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-webview WebView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration
Projects
Status: Changes Requested
5 participants