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

Add pattern syntax for optional trailing slash #3281

Open
tp971 opened this issue Feb 5, 2024 · 4 comments
Open

Add pattern syntax for optional trailing slash #3281

tp971 opened this issue Feb 5, 2024 · 4 comments
Labels
A-router project: router A-web project: actix-web C-feature Category: new functionality

Comments

@tp971
Copy link

tp971 commented Feb 5, 2024

I proposed this idea in #3258 (comment) to handle cases where trailing slashes are relevant. Basically, allow defining a route with a pattern like "/some/path/?" that matches both "/some/path" and "/some/path/". I also proposed to add a method to check whether the URI has a trailing slash, but that can also be done with request.uri().path().ends_with('/'), so idk whether we actually need this.

@robjtede robjtede added C-feature Category: new functionality A-router project: router A-web project: actix-web labels Feb 5, 2024
@deepto98
Copy link

@robjtede I'd like to work on this, could you point me to the files I need to look at?

@robjtede
Copy link
Member

@deepto98 mostly actix-router's ResourceDef... it's very well documented but lmk here or in Discord if you have questions

@altanbgn
Copy link

Any update on this? I dealt with it by adding .wrap(NormalizePath::trim())
Smh this is an open issue so

@robjtede
Copy link
Member

indeed NormalizePath is the recommended solution if you don't want to care about the distinction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-router project: router A-web project: actix-web C-feature Category: new functionality
Projects
None yet
Development

No branches or pull requests

4 participants