Skip to content

Wrond result of AntPathMatcher.combine when using template variables with some regular expressions [SPR-10062] #14695

@spring-projects-issues

Description

@spring-projects-issues

Roman Kozlov opened SPR-10062 and commented

The following code produces incorrect mapping path for method edit:

@Controller
@RequestMapping("/{foo:.*[^0-9].*}")
public class NonNumberFooController {
	@RequestMapping(value = "/edit/", method = GET)
	public String edit() {
		return "foo/edit";
	}
}

Actual result: ```
/{foo:.[^0-9].}

Expected: ```
/{foo:.*[^0-9].*}/edit/

The problem seems to be in org.springframework.util.AntPathMatcher.combine() method, that handles dots "." inside pattern specially (as filename.extension delimiter), ignoring the fact that dot can appear inside {pathVariable:regex} block as a part of regex.


Affects: 3.1.3

Referenced from: commits 33e723b

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions