]> WPIA git - gigi.git/commitdiff
UPD: Advanced wildcard syntax
authorJanis Streib <janis@dogcraft.de>
Thu, 4 Jun 2015 17:52:32 +0000 (19:52 +0200)
committerJanis Streib <janis@dogcraft.de>
Thu, 4 Jun 2015 18:02:59 +0000 (20:02 +0200)
src/org/cacert/gigi/Gigi.java
src/org/cacert/gigi/pages/admin/support/SupportUserDetailsPage.java

index 09daf6df3ccb4c3b4d9142075ca36e9a677250b5..ff7f39b52fa9840b11c916a84e69288c7fdcc1b8 100644 (file)
@@ -247,24 +247,18 @@ public class Gigi extends HttpServlet {
             return page;
         }
         int idx = pathInfo.lastIndexOf('/');
-        pathInfo = pathInfo.substring(0, idx);
 
-        page = pages.get(pathInfo + "/*");
+        page = pages.get(pathInfo.substring(0, idx) + "/*");
         if (page != null) {
             return page;
         }
 
-        idx = pathInfo.lastIndexOf('/');
-        if (idx == -1) {
+        int lIdx = pathInfo.lastIndexOf('/', idx);
+        if (lIdx == -1) {
             return null;
         }
-        pathInfo = pathInfo.substring(0, idx);
-
-        page = pages.get(pathInfo + "/*");
-        if (page != null) {
-            return page;
-        }
-        return null;
+        page = pages.get(pathInfo.substring(0, lIdx) + "/" + pathInfo.substring(idx));
+        return page;
 
     }
 
index afacb56c86e3edbfda135e4aac6f2d746aace52a..924ba08b17c1c562808c1035518481160d8f296b 100644 (file)
@@ -30,11 +30,7 @@ public class SupportUserDetailsPage extends Page {
         int id = -1;
         String[] idP = req.getPathInfo().split("/");
         try {
-            if (req.getPathInfo().endsWith("history") || req.getPathInfo().endsWith("trainings")) {
-                id = Integer.parseInt(idP[idP.length - 2]);
-            } else {
-                id = Integer.parseInt(idP[idP.length - 1]);
-            }
+            id = Integer.parseInt(idP[idP.length - 1]);
         } catch (NumberFormatException e) {
             resp.sendError(404);
         }