fix #1349 remove @Required on replacement
This commit is contained in:
parent
56cb07ffa9
commit
dff03970bb
2 changed files with 10 additions and 4 deletions
|
@ -38,7 +38,6 @@ public class CreateForm {
|
|||
@Size(max = 1000)
|
||||
public String regex;
|
||||
|
||||
@Required
|
||||
@Size(max = 1000)
|
||||
public String replacement;
|
||||
|
||||
|
|
|
@ -105,8 +105,11 @@ public class PathMappingHelper {
|
|||
String result = text;
|
||||
for (final PathMapping pathMapping : cachedPathMappingList) {
|
||||
if (matchUserAgent(pathMapping)) {
|
||||
result =
|
||||
result.replaceAll("(\"[^\"]*)" + pathMapping.getRegex() + "([^\"]*\")", "$1" + pathMapping.getReplacement() + "$2");
|
||||
String replacement = pathMapping.getReplacement();
|
||||
if (replacement == null) {
|
||||
replacement = StringUtil.EMPTY;
|
||||
}
|
||||
result = result.replaceAll("(\"[^\"]*)" + pathMapping.getRegex() + "([^\"]*\")", "$1" + replacement + "$2");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -129,7 +132,11 @@ public class PathMappingHelper {
|
|||
if (matchUserAgent(pathMapping)) {
|
||||
final Matcher matcher = pathMapping.getMatcher(newUrl);
|
||||
if (matcher.find()) {
|
||||
newUrl = matcher.replaceAll(pathMapping.getReplacement());
|
||||
String replacement = pathMapping.getReplacement();
|
||||
if (replacement == null) {
|
||||
replacement = StringUtil.EMPTY;
|
||||
}
|
||||
newUrl = matcher.replaceAll(replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue