quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.58k stars 2.63k forks source link

Reactive REST endpoints do not handle trailing slashes for paths w/ regex #42687

Open autumnfound opened 4 weeks ago

autumnfound commented 4 weeks ago

Describe the bug

When attempting to navigate to endpoints that use regex within the path expression (i.e. @Path("{somePath:[a-z]{2}}")), trailing slashes do not properly route to the resource and instead return an error that the path cannot be matched. This impacts any paths that contain regex, not just those ending with regex.

This impacts the Reactive REST quarkus-resteasy-reactive package in 3.8, and in quick testing this also impacts the current 3.13.3 release quarkus-rest package as well.

This seems to be a regression/missed aspect for the fix associated with https://github.com/quarkusio/quarkus/issues/26016.

Expected behavior

In cases where there are regex expressions within the @Path value, adding trailing slashes to the endpoint should route to the same endpoint.

Actual behavior

When a trailing slash is present for endpoints that contain a regex in the path, the endpoint doesn't properly route.

How to Reproduce?

Using reproducer project:

  1. With server started, open the following URLs in browser to confirm that endpoints do properly exist + route:
  2. In browser, open the following links to observe behaviour with trailing slashes

All 3 URLs in step 2 should pass, but only the first link does

Output of uname -a or ver

Linux pop-os 6.9.3-76060903-generic #202405300957~1721174657~22.04~abb7c06 SMP PREEMPT_DYNAMIC Wed J x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "17.0.11" 2024-04-16 OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9) OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode, sharing)

Quarkus version or git rev

3.8.5

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /home//bin/apache-maven-3.9.6 Java version: 17.0.11, vendor: Eclipse Adoptium, runtime: /home//bin/mandrel-java17-23.0.4.1-Final Default locale: en_CA, platform encoding: UTF-8 OS name: "linux", version: "6.9.3-76060903-generic", arch: "amd64", family: "unix"

Additional information

No response

quarkus-bot[bot] commented 4 weeks ago

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel)