From ed5ee3137f7ad7ba57c89772c07e99d7e2de72b7 Mon Sep 17 00:00:00 2001 From: tjlygdx Date: Wed, 10 Jun 2026 11:09:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B7=AF=E5=BE=84=E7=A9=BF=E8=B6=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/dataease/font/manage/FontManage.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java b/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java index 625fca7404..8200a6d169 100644 --- a/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java +++ b/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java @@ -27,6 +27,7 @@ import java.io.*; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -166,10 +167,9 @@ public class FontManage { if (StringUtils.isEmpty(filename) || !filename.toLowerCase().endsWith(".ttf")) { DEException.throwException("非法格式的文件!"); } - String suffix = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase(); - String fileTransName = fileNameUUID + "." + suffix; + String fileTransName = fileNameUUID + ".ttf"; Path filePath = resolveFontPath(fileTransName); - try (FileOutputStream fileOutputStream = new FileOutputStream(filePath.toFile())) { + try (OutputStream fileOutputStream = Files.newOutputStream(filePath, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)) { fileOutputStream.write(file.getBytes()); fileOutputStream.flush(); }