Skip to content

UriComponentsBuilder fromUriString cannot parse File URI #26258

@mvpcortes

Description

@mvpcortes

Hi!

I thinl I found a exception after update to spring-boot 2.4.0, 2.4.1.

A cannot parse a file uri using UriTemplateHandler. Before, in 2.3.x, I could do it.

A test example is:

 @Test public void verify() throws MalformedURLException { final UriTemplateHandler uriTemplateHandler; DefaultUriBuilderFactory uriFactory = new DefaultUriBuilderFactory(); uriFactory.setEncodingMode(DefaultUriBuilderFactory.EncodingMode.URI_COMPONENT); // for backwards compatibility.. uriTemplateHandler = uriFactory; URL url = uriTemplateHandler.expand(file.toURI().toString(), Collections.emptyMap()).toURL(); assertThat(url.toString()).isEqualTo(file.toURI().toString()); } 

file is a File object with value (toString()): /tmp/junit5116856254058695014/arquivo.txt
Sorry If I made some mistake.

Thanks

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions