Refine UriTemplate match pattern
The match/matches methods of UriTemplate use a regex with (.*) in place of URI variables, which work fine except in the end where such a pattern can match greedily more than one segment. This commit updates the regex to use ([^/]*) instead since URI variables are only meant to be used within a single path segment. Issue: SPR-16169
This commit is contained in:
@@ -212,7 +212,7 @@ public class UriTemplate implements Serializable {
|
||||
String variable = builder.toString();
|
||||
int idx = variable.indexOf(':');
|
||||
if (idx == -1) {
|
||||
pattern.append("(.*)");
|
||||
pattern.append("([^/]*)");
|
||||
variableNames.add(variable);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user