Browse Source

上传附件乱码

wangliang 1 year ago
parent
commit
8a085c9bd8

+ 1 - 1
server/src/main/java/com/qmth/jkserver/constant/SystemConstant.java

@@ -280,7 +280,7 @@ public class SystemConstant {
             target = fileStoreConfig.ossDownload(path, path, fileStoreConfig.getStorageRoot());
         } else {
             storePath = new File(fileStoreConfig.getStorageRoot());
-            target = new File(storePath, attachment.getAccessUri());
+            target = new File(storePath, attachment.getAccessUri().replaceAll("\\\\", "/"));
         }
         if (!target.exists() || !target.isFile()) {
             throw new JkServerException(JkServerException.SYSTEM_EXCEPTION.getCode(), "文件在服务器上不存在");

+ 1 - 1
server/src/main/java/com/qmth/jkserver/util/HttpUtil.java

@@ -219,7 +219,7 @@ public class HttpUtil {
         MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
         // 解决中文文件名乱码问题
         entityBuilder.setMode(HttpMultipartMode.RFC6532);
-        entityBuilder.setCharset(Consts.UTF_8);
+//        entityBuilder.setCharset(Consts.UTF_8);
         ContentType contentType = ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), Consts.UTF_8);
 
         // 构建请求参数