Skip to content

UriComponentsBuilder does not encode "$" properly [SPR-17168] #21704

Closed
@spring-projects-issues

Description

@spring-projects-issues

Andras Tornai opened SPR-17168 and commented

 

@Test
public void encodeAndExpandDollarSignParameter() {
   UriComponents uri = UriComponentsBuilder
         .fromPath("/whatever").queryParam("q", "{value}").encode().build()
         .expand("JavaClass$1.class");

   assertEquals("/whatever?q=JavaClass%241.class", uri.toString());
}

Expected :/whatever?q=JavaClass%241.class
Actual :/whatever?q=JavaClass%5C%241.class

Thus on server side the JavaClass$1.class value becomes JavaClass$1.class

I made some investigation and this extra \ is there because of this statement: d81ec55#diff-07a4953c743ebcffceaf745f59544ac7R266%C2%A0- maybe it helps

Do I use UriComponentsBuilder incorrectly?


Affects: 5.0.8

Referenced from: commits 99f0129, f23496a

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions