|
19 | 19 |
|
20 | 20 | import java.net.MalformedURLException; |
21 | 21 | import java.net.URL; |
22 | | -import java.util.ArrayList; |
23 | | -import java.util.List; |
24 | | -import java.util.Objects; |
25 | | -import java.util.Optional; |
| 22 | +import java.util.*; |
26 | 23 | import java.util.function.Predicate; |
27 | 24 | import java.util.regex.Pattern; |
28 | 25 |
|
@@ -62,7 +59,8 @@ private void validateDisplayName(String displayName, int limit, List<Issue> issu |
62 | 59 |
|
63 | 60 | private void validateDescription(String description, int limit, List<Issue> issues) { |
64 | 61 | var field = "description"; |
65 | | - checkCharacters(description, field, issues); |
| 62 | + var zeroWidthJoinerChar = '\u200D'; // character that allows combining multiple emojis into one (https://en.wikipedia.org/wiki/Zero-width_joiner) |
| 63 | + checkCharacters(description, field, issues, List.of(zeroWidthJoinerChar)); |
66 | 64 | checkFieldSize(description, limit, field, issues); |
67 | 65 | } |
68 | 66 |
|
@@ -164,11 +162,21 @@ private void checkTargetPlatform(String targetPlatform, List<Issue> issues) { |
164 | 162 | } |
165 | 163 |
|
166 | 164 | private void checkCharacters(String value, String field, List<Issue> issues) { |
| 165 | + checkCharacters(value, field, issues, Collections.emptyList()); |
| 166 | + } |
| 167 | + |
| 168 | + private void checkCharacters(String value, String field, List<Issue> issues, List<Character> allowedChars) { |
167 | 169 | if (value == null) { |
168 | 170 | return; |
169 | 171 | } |
| 172 | + |
170 | 173 | for (var i = 0; i < value.length(); i++) { |
171 | | - var type = Character.getType(value.charAt(i)); |
| 174 | + var character = value.charAt(i); |
| 175 | + if(allowedChars.contains(character)) { |
| 176 | + continue; |
| 177 | + } |
| 178 | + |
| 179 | + var type = Character.getType(character); |
172 | 180 | if (type == Character.CONTROL || type == Character.FORMAT |
173 | 181 | || type == Character.UNASSIGNED || type == Character.PRIVATE_USE |
174 | 182 | || type == Character.LINE_SEPARATOR || type == Character.PARAGRAPH_SEPARATOR) { |
|
0 commit comments