File tree Expand file tree Collapse file tree
main/java/com/retailsvc/http/internal
test/java/com/retailsvc/http/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import com .retailsvc .http .BadRequestException ;
44import java .net .URI ;
5- import java .net .URLDecoder ;
6- import java .nio .charset .StandardCharsets ;
75import java .util .regex .Pattern ;
86
97public final class ExtrasPathValidator {
@@ -31,11 +29,9 @@ public static String validateAndDecode(URI uri) {
3129 }
3230 }
3331
34- String decoded ;
35- try {
36- decoded = URLDecoder .decode (raw , StandardCharsets .UTF_8 );
37- } catch (IllegalArgumentException e ) {
38- throw new BadRequestException ("malformed percent-encoding" );
32+ String decoded = uri .getPath ();
33+ if (decoded == null ) {
34+ throw new BadRequestException ("missing path" );
3935 }
4036
4137 for (int i = 0 ; i < decoded .length (); i ++) {
Original file line number Diff line number Diff line change @@ -53,13 +53,6 @@ void backslashRejected() {
5353 assertReject ("/files/x%5Cy" );
5454 }
5555
56- @ Test
57- void literalBackslashRejected () throws Exception {
58- URI uri = new URI ("/files/x%5cy" );
59- assertThatThrownBy (() -> ExtrasPathValidator .validateAndDecode (uri ))
60- .isInstanceOf (BadRequestException .class );
61- }
62-
6356 @ Test
6457 void nulByteRejected () {
6558 assertReject ("/files/x%00.txt" );
You can’t perform that action at this time.
0 commit comments