Ver Fonte

修复:文本文档首次预览后缓存文件未清理问题

陈精华 há 5 anos atrás
pai
commit
7911edec4b

+ 3 - 0
jodconverter-web/src/main/java/cn/keking/service/impl/SimTextFilePreviewImpl.java

@@ -39,6 +39,9 @@ public class SimTextFilePreviewImpl implements FilePreview{
         try {
             File originFile = new File(response.getContent());
             File previewFile = new File(response.getContent() + ".txt");
+            if (previewFile.exists()) {
+                previewFile.delete();
+            }
             Files.copy(originFile.toPath(), previewFile.toPath());
         } catch (IOException e) {
             model.addAttribute("msg", e.getLocalizedMessage());