[Blazor][Fixes #14959] Update navlink to perform case-insensitive matches (#14991)

Otherwise the link doesn't get highlighted even though the route matches (routing is case insensitive).
This commit is contained in:
Javier Calvarro Nelson 2019-10-16 19:04:19 +02:00 committed by GitHub
parent cad6e06a83
commit efc2f024f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -175,7 +175,7 @@ namespace Microsoft.AspNetCore.Components.Routing
var prefixLength = prefix.Length; var prefixLength = prefix.Length;
if (value.Length > prefixLength) if (value.Length > prefixLength)
{ {
return value.StartsWith(prefix, StringComparison.Ordinal) return value.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)
&& ( && (
// Only match when there's a separator character either at the end of the // Only match when there's a separator character either at the end of the
// prefix or right after it. // prefix or right after it.

View File

@ -14,7 +14,7 @@
<li><NavLink href="/subdir/Default.html">With extension</NavLink></li> <li><NavLink href="/subdir/Default.html">With extension</NavLink></li>
<li><NavLink href="/subdir/Other">Other</NavLink></li> <li><NavLink href="/subdir/Other">Other</NavLink></li>
<li><NavLink href="Other" Match=NavLinkMatch.All>Other with base-relative URL (matches all)</NavLink></li> <li><NavLink href="Other" Match=NavLinkMatch.All>Other with base-relative URL (matches all)</NavLink></li>
<li><NavLink href="/subdir/Other?abc=123">Other with query</NavLink></li> <li><NavLink href="/subdir/other?abc=123">Other with query</NavLink></li>
<li><NavLink href="/subdir/Other#blah">Other with hash</NavLink></li> <li><NavLink href="/subdir/Other#blah">Other with hash</NavLink></li>
<li><NavLink href="/subdir/WithParameters/Name/Abc">With parameters</NavLink></li> <li><NavLink href="/subdir/WithParameters/Name/Abc">With parameters</NavLink></li>
<li><NavLink href="/subdir/WithParameters/Name/Abc/LastName/McDef">With more parameters</NavLink></li> <li><NavLink href="/subdir/WithParameters/Name/Abc/LastName/McDef">With more parameters</NavLink></li>