Skip to content

Bug: Blazor route discovery cannot discriminate subroutes after a parameter #35

Description

@conficient

A set of routes with different subroutes after a parameter overwrite previous routes causing mismatch.

In the BlazorRouteTests amend the code for MatchesTemplateWithParameters as follows:

        [Fact]
        public void MatchesTemplateWithParameters()
        {
            string[] templates =
            {
                "/Cats/{id}/Breed",
                "/Cats/{id}",
                "/Cats/{id}/Owner",
            };
            var target = new BlazorRoutes(templates);
            Assert.True(target.Contains("cats/42"));
            Assert.True(target.Contains("cats/42/owner"));
            Assert.True(target.Contains("cats/42/breed"));
        }

The first two tests pass but the second fails, because the last parameter route (owner) overwrites the prior one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions