diff --git a/src/main/java/org/gcube/datatransfer/resolver/http/HttpResolver.java b/src/main/java/org/gcube/datatransfer/resolver/http/HttpResolver.java index bd72682..ba697c8 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/http/HttpResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/http/HttpResolver.java @@ -50,6 +50,9 @@ public class HttpResolver extends HttpServlet { logger.info("The http session id is: " + request.getSession().getId()); + logger.debug("Original URI = "+ uri); + + uri = request.getParameter("smp-uri"); if (uri == null || uri.equals("")) { @@ -73,8 +76,19 @@ public class HttpResolver extends HttpServlet { contentType = null; } - uri = uri.replace(" ","+");//the char + is removed when the servlet is doing unescaping of the query paramenters, we just put it back + //we should not unescape the filename with spaces + + int index= uri.indexOf("?"); + if ( index!= -1) + { + String firsPart = uri.substring(0, index); + String secondPart= uri.substring( index+1); + secondPart.replace(" ","+");//the char + is removed when the servlet is doing unescaping of the query paramenters, we just put it back + uri= firsPart+"?"+secondPart; + } + else uri = uri.replace(" ","+");//the char + is removed when the servlet is doing unescaping of the query paramenters, we just put it back + logger.debug("URI = "+ uri); try {