Fix of Revision: 6b1f43efcd after code review. Rewrite the check condition.
authorNatasa Kapravelou <akapravelou@gmail.com>
Mon, 11 Oct 2010 07:56:48 +0000 (10:56 +0300)
committerNatasa Kapravelou <akapravelou@gmail.com>
Mon, 11 Oct 2010 07:56:48 +0000 (10:56 +0300)
src/gr/ebs/gss/server/rest/SearchHandler.java

index 1842468..384ac9d 100644 (file)
@@ -59,10 +59,10 @@ public class SearchHandler extends RequestHandler {
        void serveSearchResults(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         String path = getInnerPath(req, PATH_SEARCH);
 
-               if(path.indexOf("/") == 0 && path.lastIndexOf("/") == path.length()-1){
+               if(path.indexOf("/") == 0)
                        path = path.substring(1);
+               if(path.lastIndexOf("/") == path.length()-1)
                        path = path.substring(0,path.length()-1);
-               }
                if (!isValidResourceName(path)) {
                resp.sendError(HttpServletResponse.SC_BAD_REQUEST);
                return;