Skip to content

PathPatternRequestMatcherBuilder should not create a double-slash URI with a root base path #17812

@jzheaux

Description

@jzheaux

When using

PathPatternRequestMatcher.withDefaults().basePath("/").pattern("/my-pattern");

The result is a pattern of //my-pattern. The logic in pattern should be able to deal with root base paths without creating a double-slash. Instead the result should be /my-pattern.

Let's consider changing the default base path to /. Then the logic can instead be:

String prefix = ("/".equals(this.basePath)) ? "" : this.basePath;
PathPattern pathPattern = this.parser.parse(prefix + path);
// ...

Metadata

Metadata

Assignees

Labels

in: webAn issue in web modules (web, webmvc)type: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions