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

[BUG] ArmeriaServerRequest does not decode path segments #4162

Open
Uko opened this issue Nov 13, 2024 · 0 comments
Open

[BUG] ArmeriaServerRequest does not decode path segments #4162

Uko opened this issue Nov 13, 2024 · 0 comments

Comments

@Uko
Copy link
Contributor

Uko commented Nov 13, 2024

Tapir version: 1.11.8

Scala version: 2.13.15

Describe the bug

When Armeria server handles a request with encoded path e.g. MIN%2FMAX it won't decode it to MIN/MAX and the handling logic function will get the encoded MIN%2FMAX value

Investigation

While looking at the implementation of the pathSegments method from other servers I can see that there is a common implementation such as:

uri.pathSegments.segments.map(_.v).filter(_.nonEmpty).toList

however, ArmeriaServerRequest implements the method as

ctx.path().substring(1).split("/").toList

and thus does not decode the path segments

Suggestion

Right away I have to say that I'm not very familiar with Tapir code, so my ideas are based only on a brief interaction I had while researching this issue.

I can see, that there is a common approach of doing certain things, e.g.: once you have a URI, it's straightforward to extract path segments. Maybe it can be beneficial if we can extract the implementation of methods like pathSegments to the ServerRequest trait, and just have subclasses to implement the extraction of a URI from their respective data?

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

No branches or pull requests

1 participant