nonanalou commented on code in PR #30:
URL:
https://github.com/apache/sling-org-apache-sling-xss/pull/30#discussion_r1000558760
##########
src/main/java/org/apache/sling/xss/impl/AntiSamyPolicyAdapter.java:
##########
@@ -222,43 +224,28 @@ public boolean apply(String s) {
private static Predicate<String> matchesPatternsOrLiterals(List<Pattern>
patternList, boolean ignoreCase, List<String> literalList) {
return new Predicate<String>() {
public boolean apply(String s) {
- // check if the string matches to the pattern
- for (Pattern pattern : patternList) {
- if (pattern.matcher(s).matches()) {
- return true;
- }
- }
- // if the pattern does not match it goes through the literals
- for (String string : literalList) {
- s = ignoreCase
- ? s.toLowerCase()
- : s;
- if (string.equals(s)) {
- return true;
- }
- }
- // if it neither matches the patterns nor the literals it
returns false
- return false;
+ // check if the string matches to the pattern or one of the
literal
+ s = ignoreCase ? s.toLowerCase() : s;
Review Comment:
Resolved:
[9f0dbc5](https://github.com/apache/sling-org-apache-sling-xss/pull/30/commits/9f0dbc5a30a90a3949c0dcd7f2bc3b2bac41b420)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]