Skip to content

UrlResource getFilename should not contain query parameters [SPR-15411] #19974

Closed
@spring-projects-issues

Description

@spring-projects-issues

Jerome Hordies opened SPR-15411 and commented

UrlResource.getFilename uses URL.getFile() instead of URL.getPath()

The URL.getFile() javadocs say :
Gets the file name of this URL. The returned file portion will be the same as getPath(), plus the concatenation of the value of getQuery(), if any. If there is no query portion, this method and getPath() will return identical results.

This causes a bug in Spring boot when specifying --spring.config.location=http://host/group/repo/raw/branch/config.yml?private_token=NyAq4wDit3hmJ7UZPyMU because ".yml?private_token=NyAq4wDit3hmJ7UZPyMU" is not a supported extension.

My workaround until this gets fixed is to use --spring.config.location=http://host/group/repo/raw/branch/config.yml?private_token=NyAq4wDit3hmJ7UZPyMU&fake_param=whatever.yml


Affects: 3.2.18, 4.2.9, 4.3.7, 5.0 M5

Reference URL: #1372

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions