diff --git a/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/ProcessFileServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/ProcessFileServiceImpl.java index 9502edf1..21e002f5 100644 --- a/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/ProcessFileServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/ProcessFileServiceImpl.java @@ -22,8 +22,8 @@ import javax.annotation.Resource; import java.io.File; import java.io.FileInputStream; import java.net.URL; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Comparator; import java.util.List; @@ -57,10 +57,11 @@ public class ProcessFileServiceImpl implements IProcessFileService { try { URL fileUrl = getClass().getClassLoader().getResource("wordTemplate/DOCX.docx"); if (fileUrl != null) { - Path filePath = Paths.get(fileUrl.toURI()); - log.info("File path: " + filePath); + String decodedPath = URLDecoder.decode(fileUrl.getPath(), StandardCharsets.UTF_8.name()); + File file = new File(decodedPath); + System.out.println("File path: " + file.getAbsolutePath()); } else { - log.info("File not found!"); + System.err.println("File not found!"); } File file = new File(fileUrl.getFile()); FileInputStream fileInputStream = new FileInputStream(file);