Skip to content

Commit

Permalink
Fixed bug in IsSelected() implementation
Browse files Browse the repository at this point in the history
The `IsSelected()` implementation still suffixed the `webPath` and `WebPath` with a `:`, which was needed with `UniqueKey` to ensure it wasn't a partial match against an individual key (e.g., we didn't want `Root:Web:Pro` to match `Root:Web:Products`). With `WebPath`, that shouldn't be necessary, since it always ends in `/`.

That said, as web servers can be forgiving in trailing slashes, we still append a `/` at the end of `webPath` to be safe; this may result in two `//` at the end, but that won't impact the logic.
  • Loading branch information
JeremyCaney committed Feb 22, 2021
1 parent 8fd4d80 commit 7a6e7ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion OnTopic.ViewModels/NavigationTopicViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public sealed record NavigationTopicViewModel : INavigationTopicViewModel<Naviga
/// typically meaning the user is on the page this object is pointing to.
/// </summary>
public bool IsSelected(string webPath) =>
$"{webPath}:".StartsWith($"{WebPath}:", StringComparison.OrdinalIgnoreCase);
$"{webPath}/".StartsWith($"{WebPath}", StringComparison.OrdinalIgnoreCase);

} //Class
} //Namespace

0 comments on commit 7a6e7ef

Please sign in to comment.