diff --git a/src/main/java/cokr/xit/fims/base/FileController.java b/src/main/java/cokr/xit/fims/base/FileController.java index 51c7cebc..5531a2c3 100644 --- a/src/main/java/cokr/xit/fims/base/FileController.java +++ b/src/main/java/cokr/xit/fims/base/FileController.java @@ -1,11 +1,13 @@ package cokr.xit.fims.base; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.StringWriter; import java.net.URISyntaxException; import java.net.URLDecoder; +import java.util.regex.Matcher; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -78,14 +80,16 @@ public class FileController extends cokr.xit.base.file.web.FileController { String requestURI = request.getRequestURI().toString(); String filepath = requestURI.split("modifySvg")[1]; - filepath = URLDecoder.decode(filepath); - filepath = filepath.replace("\\","/"); - String svgRootPath = ("classpath:svg"); - filepath = svgRootPath + filepath; + filepath = URLDecoder.decode(filepath, "UTF-8"); + filepath = filepath.replaceAll("/", Matcher.quoteReplacement(File.separator)); + filepath = "svg" + filepath; + + ClassPathResource resource = new ClassPathResource(filepath); + InputStream is = resource.getInputStream(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = factory.newDocumentBuilder(); - Document document = documentBuilder.parse(filepath); + Document document = documentBuilder.parse(is); Element root = document.getDocumentElement(); NodeList nodeList = root.getChildNodes();