Skip to content
This repository was archived by the owner on Jan 24, 2021. It is now read-only.
This repository was archived by the owner on Jan 24, 2021. It is now read-only.

Greedy Route capturing too much within the DynamicDictionary when defining multiple routes that are Greedy. #1728

@06b

Description

@06b

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of Nancy
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

The DynamicDictionary captures too much when using the Greedy Route when defining multiple routes that are greedy.

Steps to Reproduce

Request: "http://localhost/page/1/hello"
Route template "/{captureseg?}/{greedy_}"
captureseg = "page"
greedy = "1/hello"
*This seems correct_

Request: "http://localhost/page/1"
Route template "/{captureseg?}/{greedy_}"
captureseg = "page"
greedy = "1"
*This seems correct_

Request: "http://localhost/page/"
Route template "/{captureseg?}/{greedy_}"
captureseg = ""
greedy = "page"
_This is expected due to what #1534 reports (Side Note: Duplicate bug #1573), so I'll assume this is correct behavior as of right now*

Now for what I've noticed.

        Get["/test/{captureseg?}/{greedy*}"] = _ =>
        {
                var captureseg = _.captureseg;
                var greedy = _.greedy;
        }

Request: "http://localhost/test/page/"
captureseg = ""
greedy = "test/page" * Expected page not test/page*

Request: "http://localhost/test/something/page/123"
captureseg = "something"
greedy = "page/123" Greedy segment works as expected

However if add a default value to optional capture segments such as below

        Get["/test/{captureseg?helloworld}/{greedy*}"] = _ =>
        {
                var captureseg = _.captureseg;
                var greedy = _.greedy;
        }

Request: "http://localhost/test/page/"
captureseg = "helloworld"
greedy = "page" Now the greedy segment works as expected

Request: "http://localhost/test/hello/page/123"
captureseg = "hello"
greedy = "page/123" Greedy segment works as expected

System Configuration

  • Nancy version:
  • Nancy host
    • ASP.NET
    • OWIN
    • Self-Hosted
    • Other:
  • Other Nancy packages and versions:
  • Environment (Operating system, version and so on):
  • .NET Framework version:
  • Additional information:

Still need to complete editing this issue with the updated issue template.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions