fix(系统设置): 移除代码逻辑中的部分文件限制
This commit is contained in:
parent
73bf491e1d
commit
308b568931
|
@ -56,7 +56,7 @@ public class BugAttachmentControllerTests extends BaseTest {
|
|||
@Order(0)
|
||||
void testUploadMdFile() throws Exception {
|
||||
MockMultipartFile fileTooLarge = new MockMultipartFile("file", "test.txt", MediaType.APPLICATION_OCTET_STREAM_VALUE, new byte[50 * 1024 * 1024 + 1]);
|
||||
this.requestUploadFile(BUG_ATTACHMENT_UPLOAD_MD, fileTooLarge).andExpect(status().is5xxServerError());
|
||||
this.requestUploadFile(BUG_ATTACHMENT_UPLOAD_MD, fileTooLarge).andExpect(status().is2xxSuccessful());
|
||||
MockMultipartFile fileWithNoName = new MockMultipartFile("file", "", MediaType.APPLICATION_OCTET_STREAM_VALUE, "aa".getBytes());
|
||||
this.requestUploadFile(BUG_ATTACHMENT_UPLOAD_MD, fileWithNoName).andExpect(status().is5xxServerError());
|
||||
// Mock minio save file exception
|
||||
|
|
|
@ -15,8 +15,6 @@ import io.metersphere.project.domain.FileAssociation;
|
|||
import io.metersphere.project.dto.filemanagement.FileInfo;
|
||||
import io.metersphere.project.dto.filemanagement.FileLogRecord;
|
||||
import io.metersphere.project.service.FileAssociationService;
|
||||
import io.metersphere.system.service.CommonFileService;
|
||||
import io.metersphere.system.service.FileService;
|
||||
import io.metersphere.sdk.constants.DefaultRepositoryDir;
|
||||
import io.metersphere.sdk.constants.StorageType;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
|
@ -29,6 +27,8 @@ import io.metersphere.system.domain.User;
|
|||
import io.metersphere.system.domain.UserExample;
|
||||
import io.metersphere.system.log.constants.OperationLogModule;
|
||||
import io.metersphere.system.mapper.UserMapper;
|
||||
import io.metersphere.system.service.CommonFileService;
|
||||
import io.metersphere.system.service.FileService;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -109,9 +109,6 @@ public class FunctionalCaseAttachmentService {
|
|||
fileRequest.setFileName(file.getOriginalFilename());
|
||||
fileRequest.setFolder(DefaultRepositoryDir.getFunctionalCaseDir(projectId, caseId) + "/" + fileId);
|
||||
fileRequest.setStorage(StorageType.MINIO.name());
|
||||
if (file.getSize() > maxFileSize.toBytes()) {
|
||||
throw new MSException(Translator.get("file.size.is.too.large"));
|
||||
}
|
||||
try {
|
||||
fileService.upload(file, fileRequest);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -150,9 +150,6 @@ public class FileMetadataService {
|
|||
}
|
||||
|
||||
public FileMetadata genFileMetadata(String fileSpecifyName, String filePath, String storage, long size, boolean enable, String projectId, String moduleId, String operator) {
|
||||
if (size > maxFileSize.toBytes()) {
|
||||
throw new MSException(Translator.get("file.size.is.too.large"));
|
||||
}
|
||||
FileMetadata fileMetadata = new FileMetadata();
|
||||
this.parseAndSetFileNameType(filePath, fileMetadata);
|
||||
//如果开启了开关,检查是否是jar文件
|
||||
|
|
|
@ -44,9 +44,6 @@ public class CommonFileService {
|
|||
*/
|
||||
public String uploadTempImgFile(MultipartFile file) {
|
||||
String fileName = StringUtils.trim(file.getOriginalFilename());
|
||||
if (file.getSize() > maxFileSize.toBytes()) {
|
||||
throw new MSException(Translator.get("file.size.is.too.large"));
|
||||
}
|
||||
if (StringUtils.isBlank(fileName)) {
|
||||
throw new MSException(Translator.get("file.name.cannot.be.empty"));
|
||||
}
|
||||
|
|
|
@ -255,11 +255,6 @@ public class SimpleUserService {
|
|||
}
|
||||
|
||||
public UserImportResponse importByExcel(MultipartFile excelFile, String source, String sessionId) {
|
||||
|
||||
if (excelFile.getSize() > maxImportFileSize.toBytes()) {
|
||||
throw new MSException(Translator.get("file.size.is.too.large"));
|
||||
}
|
||||
|
||||
UserImportResponse importResponse = new UserImportResponse();
|
||||
ExcelParseDTO<UserExcelRowDTO> excelParseDTO = new ExcelParseDTO<>();
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue