Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ocelot can't match placeholders between slashes #2199

Closed
ggnaegi opened this issue Nov 12, 2024 · 1 comment · Fixed by #2200
Closed

Ocelot can't match placeholders between slashes #2199

ggnaegi opened this issue Nov 12, 2024 · 1 comment · Fixed by #2200
Assignees
Labels
bug Identified as a potential bug merged Issue has been merged to dev and is waiting for the next release Nov'24 November 2024 release Routing Ocelot feature: Routing
Milestone

Comments

@ggnaegi
Copy link
Member

ggnaegi commented Nov 12, 2024

Expected Behavior / New Feature

Ocelot should be capable of matching paths that contain placeholders embedded between slashes, such as:
/api/invoices_{url0}/{url1}-{url2}_abcd/{url3}?urlId={url4}.

Actual Behavior / Motivation for New Feature

Currently, Ocelot cannot match placeholders embedded between slashes. For example: /api/test/{url}-2 -> request: /api/test/a-2 -> the result will incorrectly return {url} = a-2.

Steps to Reproduce the Problem

  1. Try any template with placeholders embedded between slashes
@ggnaegi ggnaegi added bug Identified as a potential bug Routing Ocelot feature: Routing labels Nov 12, 2024
@ggnaegi ggnaegi self-assigned this Nov 12, 2024
@raman-m raman-m added the accepted Bug or feature would be accepted as a PR or is being worked on label Nov 13, 2024
@raman-m
Copy link
Member

raman-m commented Nov 13, 2024

Accepted due open PR #2200

@raman-m raman-m added in progress Someone is working on the issue. Could be someone on the team or off. Dec'24 December 2024 release and removed in progress Someone is working on the issue. Could be someone on the team or off. labels Nov 14, 2024
@raman-m raman-m added this to the Autumn'24 milestone Nov 17, 2024
ggnaegi added a commit that referenced this issue Nov 17, 2024
* Adding support for placeholder matching between slashes.

* now the behavior is right, it can't be that {finalUrlPath} matches product/products/categories/ since the last slash is part of the template and not the catch-all placeholder

* Performance improvements for EscapeExceptBraces

* EOL: test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinderTests.cs
Recover old test for feat 89.
Remove BDDfy from new unit tests.
Apply AAA-pattern.

* Review user scenarios of feat #89 tests

* Refactor unit tests

* Refactor acceptance tests

* Adding documentation for embedded placeholders

* Adding acceptance tests

* Adding suggestions

* again...

* Final code review by @raman-m.
FindGroups method is private, better to return exact type.
Regex optimizations across net6, 7, 8.
XML dev-docs markup review.
Rename 'curly bracket' to 'brace'.

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
@raman-m raman-m added merged Issue has been merged to dev and is waiting for the next release Nov'24 November 2024 release and removed accepted Bug or feature would be accepted as a PR or is being worked on Dec'24 December 2024 release labels Nov 17, 2024
@raman-m raman-m modified the milestones: Autumn'24, November'24 Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identified as a potential bug merged Issue has been merged to dev and is waiting for the next release Nov'24 November 2024 release Routing Ocelot feature: Routing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants