File tree 1 file changed +7
-4
lines changed
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
package io .quarkus .vertx .http .runtime ;
2
2
3
- import java .net .URI ;
4
3
import java .util .Set ;
5
4
6
5
import io .vertx .core .http .HttpHeaders ;
7
6
import io .vertx .core .http .impl .MimeMapping ;
7
+ import io .vertx .core .net .impl .URIDecoder ;
8
8
import io .vertx .ext .web .RoutingContext ;
9
9
import io .vertx .ext .web .handler .StaticHandler ;
10
10
@@ -17,18 +17,21 @@ private RoutingUtils() throws IllegalAccessException {
17
17
/**
18
18
* Get the normalized and decoded path:
19
19
* - normalize based on RFC3986
20
- * - convert % encoded characters to their non encoded form (using {@link java.net.URI })
20
+ * - convert % encoded characters to their non encoded form (using {@link URIDecoder#decodeURIComponent })
21
21
* - invalid if the path contains '?' (query section of the path)
22
22
*
23
23
* @param ctx the RoutingContext
24
24
* @return the normalized and decoded path or null if not valid
25
25
*/
26
26
public static String getNormalizedAndDecodedPath (RoutingContext ctx ) {
27
27
String normalizedPath = ctx .normalizedPath ();
28
- if (normalizedPath .contains ( "?" ) ) {
28
+ if (normalizedPath .indexOf ( '?' ) != - 1 ) {
29
29
return null ;
30
30
}
31
- return URI .create (normalizedPath ).getPath ();
31
+ if (normalizedPath .indexOf ('%' ) == -1 ) {
32
+ return normalizedPath ;
33
+ }
34
+ return URIDecoder .decodeURIComponent (normalizedPath );
32
35
}
33
36
34
37
/**
You can’t perform that action at this time.
0 commit comments