From efc2f024f38978d135407f08db7445077e590a45 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Wed, 16 Oct 2019 19:04:19 +0200 Subject: [PATCH] [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). --- src/Components/Web/src/Routing/NavLink.cs | 2 +- .../test/testassets/BasicTestApp/RouterTest/Links.razor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Web/src/Routing/NavLink.cs b/src/Components/Web/src/Routing/NavLink.cs index cb3e68a2d4..799405f602 100644 --- a/src/Components/Web/src/Routing/NavLink.cs +++ b/src/Components/Web/src/Routing/NavLink.cs @@ -175,7 +175,7 @@ namespace Microsoft.AspNetCore.Components.Routing var prefixLength = prefix.Length; 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 // prefix or right after it. diff --git a/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor b/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor index 291c325fec..98f6dd5497 100644 --- a/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor +++ b/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor @@ -14,7 +14,7 @@
  • With extension
  • Other
  • Other with base-relative URL (matches all)
  • -
  • Other with query
  • +
  • Other with query
  • Other with hash
  • With parameters
  • With more parameters