Skip to content

Commit b91a9b7

Browse files
committed
Improved: Normalize contextPath in hasBasePermission (OFBIZ-12887)
Better have a normalized contextPath in LoginWorker::hasBasePermission
1 parent c910e41 commit b91a9b7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
2222

2323
import java.math.BigInteger;
24+
import java.net.URI;
25+
import java.net.URISyntaxException;
2426
import java.security.cert.X509Certificate;
2527
import java.sql.Timestamp;
2628
import java.util.ArrayList;
@@ -1364,6 +1366,13 @@ public static boolean hasBasePermission(GenericValue userLogin, HttpServletReque
13641366
if (UtilValidate.isEmpty(contextPath)) {
13651367
contextPath = "/";
13661368
}
1369+
1370+
try {
1371+
contextPath = new URI(contextPath).normalize().toString();
1372+
} catch (URISyntaxException e) {
1373+
throw new RuntimeException(e);
1374+
}
1375+
13671376
ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath);
13681377
if (info != null) {
13691378
return hasApplicationPermission(info, security, userLogin);

0 commit comments

Comments
 (0)