Skip to content

Un-deprecate PathResource (for java.nio.file.Path resolution in createRelative) #24211

@userquin

Description

@userquin

When creating a FileSystemResource with a Path containing .. in the path, then createRelative resolves to a wrong path.

The problem resides on StringUtils::applyRelativePath method: I suggest change the method on FileSystemResource checking first if the location is a Path and then use Path::resolve instead calling StringUtils::applyRelativePath.

println(FileSystemResource(Paths.get("../xxxx/dist/")).createRelative("index.html"))

print ../index.html instead ../xxx/dist/index.html.

Attached image shows the variables inside FileSystemResource::createRelative method.

bug

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions