fix(用例管理): 修复文件大于50M时没有提示问题
--bug=1036494 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036494
This commit is contained in:
parent
67d56687c0
commit
e28284be97
|
@ -504,7 +504,7 @@ file.log.association.update=更新了关联了文件
|
|||
file.log.association.delete=取消关联了文件
|
||||
file.log.transfer.association=转存并关联了文件
|
||||
file.name.cannot.be.empty=文件名称不能为空
|
||||
file.size.is.too.large=文件过大
|
||||
file.size.is.too.large=文件不能超过50M
|
||||
file.is.empty=文件为空
|
||||
file.name.error=文件名不合法
|
||||
#file management over
|
||||
|
|
|
@ -540,7 +540,7 @@ file.log.association.update=updated file
|
|||
file.log.association.delete=delete file
|
||||
file.log.transfer.association=transfer and association file
|
||||
file.name.cannot.be.empty=File name cannot be empty
|
||||
file.size.is.too.large=File is too large
|
||||
file.size.is.too.large=File cannot exceed 50M
|
||||
file.is.empty=File is empty
|
||||
file.name.error=File name error
|
||||
#file management over
|
||||
|
|
|
@ -539,7 +539,7 @@ file.log.association.update=更新了关联了文件
|
|||
file.log.association.delete=取消关联了文件
|
||||
file.log.transfer.association=转存并关联了文件
|
||||
file.name.cannot.be.empty=文件名称不能为空
|
||||
file.size.is.too.large=文件过大
|
||||
file.size.is.too.large=文件不能超过50M
|
||||
file.is.empty=文件为空
|
||||
file.name.error=文件名不合法
|
||||
#file management over
|
||||
|
|
|
@ -539,7 +539,7 @@ file.log.association.update=更新了關聯了文件
|
|||
file.log.association.delete=取消關聯了文件
|
||||
file.log.transfer.association=轉存並關聯了文件
|
||||
file.name.cannot.be.empty=文件名稱不能為空
|
||||
file.size.is.too.large=文件過大
|
||||
file.size.is.too.large=文件不能超過50M
|
||||
file.is.empty=文件為空
|
||||
file.name.error=文件名不合法
|
||||
#file management over
|
||||
|
|
|
@ -104,6 +104,9 @@ 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) {
|
||||
|
|
|
@ -49,6 +49,7 @@ import org.springframework.mock.web.MockMultipartFile;
|
|||
import org.springframework.test.context.jdbc.Sql;
|
||||
import org.springframework.test.context.jdbc.SqlConfig;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -218,8 +219,12 @@ public class FunctionalCaseControllerTests extends BaseTest {
|
|||
functionalCaseAttachmentExample.createCriteria().andCaseIdEqualTo(functionalCase.getId()).andFileIdEqualTo(newFileId);
|
||||
functionalCaseAttachments = functionalCaseAttachmentMapper.selectByExample(functionalCaseAttachmentExample);
|
||||
Assertions.assertEquals(1, functionalCaseAttachments.size());
|
||||
|
||||
|
||||
byte[] array = new byte[55 * 1024 * 1024];
|
||||
file = new MockMultipartFile("file", "file_re-upload.JPG", MediaType.APPLICATION_OCTET_STREAM_VALUE, array);
|
||||
files.add(file);
|
||||
paramMap.add("files", files);
|
||||
ResultActions resultActions = this.requestMultipart(FUNCTIONAL_CASE_ADD_URL, paramMap);
|
||||
resultActions.andExpect(status().is5xxServerError());
|
||||
}
|
||||
|
||||
public String uploadTemp(MultipartFile file) {
|
||||
|
|
Loading…
Reference in New Issue