Skip to content

Commit 0d9ac6e

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

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;
@@ -1372,6 +1374,13 @@ public static boolean hasBasePermission(GenericValue userLogin, HttpServletReque
13721374
if (UtilValidate.isEmpty(contextPath)) {
13731375
contextPath = "/";
13741376
}
1377+
1378+
try {
1379+
contextPath = new URI(contextPath).normalize().toString();
1380+
} catch (URISyntaxException e) {
1381+
throw new RuntimeException(e);
1382+
}
1383+
13751384
ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath);
13761385
if (info != null) {
13771386
return hasApplicationPermission(info, security, userLogin);

0 commit comments

Comments
 (0)