Improve regex support for URL path matching
Closes gh-28815
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,15 +59,9 @@ class CaptureVariablePathElement extends PathElement {
|
||||
}
|
||||
else {
|
||||
this.variableName = new String(captureDescriptor, 1, colon - 1);
|
||||
if (caseSensitive) {
|
||||
this.constraintPattern = Pattern.compile(
|
||||
new String(captureDescriptor, colon + 1, captureDescriptor.length - colon - 2));
|
||||
}
|
||||
else {
|
||||
this.constraintPattern = Pattern.compile(
|
||||
new String(captureDescriptor, colon + 1, captureDescriptor.length - colon - 2),
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
}
|
||||
this.constraintPattern = Pattern.compile(
|
||||
new String(captureDescriptor, colon + 1, captureDescriptor.length - colon - 2),
|
||||
Pattern.DOTALL | (caseSensitive ? 0 : Pattern.CASE_INSENSITIVE));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -108,12 +108,8 @@ class RegexPathElement extends PathElement {
|
||||
}
|
||||
|
||||
patternBuilder.append(quote(text, end, text.length()));
|
||||
if (this.caseSensitive) {
|
||||
return Pattern.compile(patternBuilder.toString());
|
||||
}
|
||||
else {
|
||||
return Pattern.compile(patternBuilder.toString(), Pattern.CASE_INSENSITIVE);
|
||||
}
|
||||
return Pattern.compile(patternBuilder.toString(),
|
||||
Pattern.DOTALL | (this.caseSensitive ? 0 : Pattern.CASE_INSENSITIVE));
|
||||
}
|
||||
|
||||
public List<String> getVariableNames() {
|
||||
|
||||
Reference in New Issue
Block a user