diff --git a/backend/src/main/java/io/metersphere/base/domain/FileContent.java b/backend/src/main/java/io/metersphere/base/domain/FileContent.java
index 9c36fe33ba..3efd113734 100644
--- a/backend/src/main/java/io/metersphere/base/domain/FileContent.java
+++ b/backend/src/main/java/io/metersphere/base/domain/FileContent.java
@@ -5,7 +5,7 @@ import java.io.Serializable;
public class FileContent implements Serializable {
private String fileId;
- private String file;
+ private byte[] file;
private static final long serialVersionUID = 1L;
@@ -17,11 +17,11 @@ public class FileContent implements Serializable {
this.fileId = fileId == null ? null : fileId.trim();
}
- public String getFile() {
+ public byte[] getFile() {
return file;
}
- public void setFile(String file) {
- this.file = file == null ? null : file.trim();
+ public void setFile(byte[] file) {
+ this.file = file;
}
}
\ No newline at end of file
diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.xml
index 992afb28f2..daa7f4ff8f 100644
--- a/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.xml
+++ b/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.xml
@@ -5,7 +5,7 @@
-
+
@@ -121,7 +121,7 @@
insert into file_content (file_id, file)
- values (#{fileId,jdbcType=VARCHAR}, #{file,jdbcType=LONGVARCHAR})
+ values (#{fileId,jdbcType=VARCHAR}, #{file,jdbcType=LONGVARBINARY})
insert into file_content
@@ -138,7 +138,7 @@
#{fileId,jdbcType=VARCHAR},
- #{file,jdbcType=LONGVARCHAR},
+ #{file,jdbcType=LONGVARBINARY},
@@ -155,7 +155,7 @@
file_id = #{record.fileId,jdbcType=VARCHAR},
- file = #{record.file,jdbcType=LONGVARCHAR},
+ file = #{record.file,jdbcType=LONGVARBINARY},
@@ -165,7 +165,7 @@
update file_content
set file_id = #{record.fileId,jdbcType=VARCHAR},
- file = #{record.file,jdbcType=LONGVARCHAR}
+ file = #{record.file,jdbcType=LONGVARBINARY}
@@ -181,14 +181,14 @@
update file_content
- file = #{file,jdbcType=LONGVARCHAR},
+ file = #{file,jdbcType=LONGVARBINARY},
where file_id = #{fileId,jdbcType=VARCHAR}
update file_content
- set file = #{file,jdbcType=LONGVARCHAR}
+ set file = #{file,jdbcType=LONGVARBINARY}
where file_id = #{fileId,jdbcType=VARCHAR}
\ No newline at end of file
diff --git a/backend/src/main/java/io/metersphere/commons/utils/DBCompressConfig.java b/backend/src/main/java/io/metersphere/commons/utils/DBCompressConfig.java
deleted file mode 100644
index 51c1131a9e..0000000000
--- a/backend/src/main/java/io/metersphere/commons/utils/DBCompressConfig.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package io.metersphere.commons.utils;
-
-import org.springframework.stereotype.Component;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-@Component
-public class DBCompressConfig implements MybatisInterceptorConfigHolder {
- @Override
- public List interceptorConfig() {
-// return Arrays.asList(
-// new MybatisInterceptorConfig("io.metersphere.base.domain.FileContent", "file", "io.metersphere.commons.utils.CompressUtils", "zip", "unzip")
-// );
- return Collections.emptyList();
- }
-}
\ No newline at end of file
diff --git a/backend/src/main/java/io/metersphere/config/DBCompressConfig.java b/backend/src/main/java/io/metersphere/config/DBCompressConfig.java
new file mode 100644
index 0000000000..3e7431a9d1
--- /dev/null
+++ b/backend/src/main/java/io/metersphere/config/DBCompressConfig.java
@@ -0,0 +1,19 @@
+package io.metersphere.config;
+
+import io.metersphere.commons.utils.MybatisInterceptorConfig;
+import io.metersphere.commons.utils.MybatisInterceptorConfigHolder;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Arrays;
+import java.util.List;
+
+@Configuration
+public class DBCompressConfig implements MybatisInterceptorConfigHolder {
+ @Override
+ public List interceptorConfig() {
+ return Arrays.asList(
+ new MybatisInterceptorConfig("io.metersphere.base.domain.FileContent", "file", "io.metersphere.commons.utils.CompressUtils", "zip", "unzip")
+ );
+// return Collections.emptyList();
+ }
+}
\ No newline at end of file
diff --git a/backend/src/main/java/io/metersphere/engine/EngineFactory.java b/backend/src/main/java/io/metersphere/engine/EngineFactory.java
index c17671f29e..ae90a1cd89 100644
--- a/backend/src/main/java/io/metersphere/engine/EngineFactory.java
+++ b/backend/src/main/java/io/metersphere/engine/EngineFactory.java
@@ -14,7 +14,6 @@ import org.apache.commons.lang3.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
public class EngineFactory {
public static Engine createEngine(String engineType) {
@@ -29,7 +28,7 @@ public class EngineFactory {
public static EngineContext createContext(LoadTestWithBLOBs loadTest, FileMetadata fileMetadata, FileContent fileContent) throws Exception {
final EngineContext engineContext = new EngineContext();
engineContext.setEngineId(loadTest.getId());
- engineContext.setInputStream(new ByteArrayInputStream(fileContent.getFile().getBytes(StandardCharsets.UTF_8)));
+ engineContext.setInputStream(new ByteArrayInputStream(fileContent.getFile()));
engineContext.setEngineType(fileMetadata.getType());
if (!StringUtils.isEmpty(loadTest.getLoadConfiguration())) {
diff --git a/backend/src/main/java/io/metersphere/service/LoadTestService.java b/backend/src/main/java/io/metersphere/service/LoadTestService.java
index 43e99a3f0d..baf41a1ca2 100644
--- a/backend/src/main/java/io/metersphere/service/LoadTestService.java
+++ b/backend/src/main/java/io/metersphere/service/LoadTestService.java
@@ -5,7 +5,6 @@ import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
import io.metersphere.commons.constants.EngineType;
import io.metersphere.commons.exception.MSException;
-import io.metersphere.commons.utils.IOUtils;
import io.metersphere.controller.request.testplan.*;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.engine.Engine;
@@ -19,7 +18,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.UUID;
@@ -115,7 +113,7 @@ public class LoadTestService {
FileContent fileContent = new FileContent();
fileContent.setFileId(fileMetadata.getId());
try {
- fileContent.setFile(IOUtils.toString(file.getInputStream(), StandardCharsets.UTF_8));
+ fileContent.setFile(file.getBytes());
} catch (IOException e) {
MSException.throwException(e);
}