Skip to content

Commit 84f6748

Browse files
author
Bauke Scholtz
committed
Fix isPrefixMatch() to not match extension based URls.
1 parent 55a0b56 commit 84f6748

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/omnifaces/config/WebXml.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,11 @@ private static boolean isExactMatch(String urlPattern, String url) {
305305
}
306306

307307
private static boolean isPrefixMatch(String urlPattern, String url) {
308-
return urlPattern.endsWith("/*") ? url.startsWith(urlPattern.substring(0, urlPattern.length() - 2)) : false;
308+
return urlPattern.endsWith("/*") && (url + "/").startsWith(urlPattern.substring(0, urlPattern.length() - 1));
309309
}
310310

311311
private static boolean isSuffixMatch(String urlPattern, String url) {
312-
return urlPattern.startsWith("*.") ? url.endsWith(urlPattern.substring(1)) : false;
312+
return urlPattern.startsWith("*.") && url.endsWith(urlPattern.substring(1));
313313
}
314314

315315
private static boolean isRoleMatch(Set<String> roles, String role) {

0 commit comments

Comments
 (0)