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

rewritePath function in BeforeFilterFunctions doesn't support url encoded #3657

Open
RomainPro76 opened this issue Jan 3, 2025 · 0 comments

Comments

@RomainPro76
Copy link

Describe the bug
I'm using the function rewritePath in org.springframework.cloud.gatexay.server.mvc.BeforeFilterFunctions in a RouterFunction policy. It works well excepts when the url contains an encoded character.
With an encoded character (ex /testé), the output url will transform as /test%25C3%25A9 instead of /test%C3%A9.

In fact, in the rewritePath method, it doesn't take into account the encoded url :

URI rewrittenUri = UriComponentsBuilder.fromUri(request.uri()).replacePath(newPath).build().toUri();

It works well with :

URI rewrittenUri = UriComponentsBuilder.fromUri(request.uri()).replacePath(newPath).build(true).toUri();

Is it intended that the rewritePath method be written like this ? or is it a bug ?

Test case

call the gateway app with an accentuated character in the url (ex: GET /testé). your http client librairie will encoded the url as GET /test%C3%A9. and the output will be /test%25C3%25A9.

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

No branches or pull requests

1 participant