From bf846cb845dc6b04fdb15caa31b4b20f2d6c368b Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Fri, 25 Oct 2019 17:46:03 +0200 Subject: [PATCH] [Blazor][Fixes #14959] NavLink match should be case-insensitive (#15401) --- src/Components/Web/src/Routing/NavLink.cs | 4 ++-- .../test/testassets/BasicTestApp/RouterTest/Links.razor | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/Web/src/Routing/NavLink.cs b/src/Components/Web/src/Routing/NavLink.cs index 799405f602..5dda2fe014 100644 --- a/src/Components/Web/src/Routing/NavLink.cs +++ b/src/Components/Web/src/Routing/NavLink.cs @@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Components.Routing private bool EqualsHrefExactlyOrIfTrailingSlashAdded(string currentUriAbsolute) { - if (string.Equals(currentUriAbsolute, _hrefAbsolute, StringComparison.Ordinal)) + if (string.Equals(currentUriAbsolute, _hrefAbsolute, StringComparison.OrdinalIgnoreCase)) { return true; } @@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Components.Routing // for http://host/vdir as they do for host://host/vdir/ as it's no // good to display a blank page in that case. if (_hrefAbsolute[_hrefAbsolute.Length - 1] == '/' - && _hrefAbsolute.StartsWith(currentUriAbsolute, StringComparison.Ordinal)) + && _hrefAbsolute.StartsWith(currentUriAbsolute, StringComparison.OrdinalIgnoreCase)) { return true; } diff --git a/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor b/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor index 98f6dd5497..536fa70ad3 100644 --- a/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor +++ b/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor @@ -16,7 +16,7 @@
  • Other with base-relative URL (matches all)
  • Other with query
  • Other with hash
  • -
  • With parameters
  • +
  • With parameters
  • With more parameters
  • Long page 1
  • Long page 2