Deal with URL-encoded form paths.
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 8 Jun 2021 09:17:02 +0000 (11:17 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 8 Jun 2021 09:17:02 +0000 (11:17 +0200)
knowledge/org.argeo.support.odk/src/org/argeo/support/odk/servlet/OdkFormServlet.java

index 7b727e32591dc4a8fe7c2e22965c09522741316f..cab562cc6465fbd462d3675bec8f7b4f2e9fda27 100644 (file)
@@ -3,6 +3,8 @@ package org.argeo.support.odk.servlet;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -41,7 +43,8 @@ public class OdkFormServlet extends HttpServlet {
                boolean oldApproach = false;
                try {
                        if (!oldApproach) {
-                               session.exportDocumentView(pathInfo + "/" + OdkNames.H_HTML, resp.getOutputStream(), true, false);
+                               String path = URLDecoder.decode(pathInfo, StandardCharsets.UTF_8);
+                               session.exportDocumentView(path + "/" + OdkNames.H_HTML, resp.getOutputStream(), true, false);
                        } else {
 
                                String fileName = FilenameUtils.getName(pathInfo);