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);
// ...

Comment From: therepanic

Hi, @jzheaux! I can work on this if you dont mind

Comment From: ngocnhan-tran1996

Can I work on this?

Comment From: therepanic

Thanks for your interest, @ngocnhan-tran1996! I’ve already started working on this issue, so I’ll go ahead and continue with the fix.

Comment From: jzheaux

Closed in favor of https://github.com/spring-projects/spring-security/pull/17841